点检计划
parent
337eb97c68
commit
fe0727c0d1
@ -0,0 +1,115 @@
|
||||
package com.op.device.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.op.common.core.web.controller.BaseController;
|
||||
import com.op.device.domain.EquPlanEqu;
|
||||
import com.op.device.service.IEquSpotCheckService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.op.common.log.annotation.Log;
|
||||
import com.op.common.log.enums.BusinessType;
|
||||
import com.op.common.security.annotation.RequiresPermissions;
|
||||
import com.op.device.domain.EquPlan;
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import com.op.common.core.utils.poi.ExcelUtil;
|
||||
import com.op.common.core.web.page.TableDataInfo;
|
||||
|
||||
import static com.op.common.core.utils.PageUtils.startPage;
|
||||
import static com.op.common.core.web.domain.AjaxResult.success;
|
||||
|
||||
/**
|
||||
* 点检计划Controller
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-10-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/spotCheckPlan")
|
||||
public class EquSpotCheckController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IEquSpotCheckService equSpotCheckService;
|
||||
|
||||
/**
|
||||
* 处理计划-设备信息
|
||||
*
|
||||
* @param equPlanEquList
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/formatEquItem")
|
||||
public AjaxResult formatEquItem(@RequestBody List<EquPlanEqu> equPlanEquList) {
|
||||
return equSpotCheckService.formatEquItem(equPlanEquList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询点检计划列表
|
||||
*/
|
||||
@RequiresPermissions("device:spotCheckPlan:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EquPlan equPlan) {
|
||||
startPage();
|
||||
List<EquPlan> list = equSpotCheckService.selectEquPlanList(equPlan);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出点检计划列表
|
||||
*/
|
||||
@RequiresPermissions("device:spotCheckPlan:export")
|
||||
@Log(title = "点检计划", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EquPlan equPlan) {
|
||||
List<EquPlan> list = equSpotCheckService.selectEquPlanList(equPlan);
|
||||
ExcelUtil<EquPlan> util = new ExcelUtil<EquPlan>(EquPlan.class);
|
||||
util.exportExcel(response, list, "点检计划数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取点检计划详细信息
|
||||
*/
|
||||
@RequiresPermissions("device:spotCheckPlan:query")
|
||||
@GetMapping(value = "/{planId}")
|
||||
public AjaxResult getInfo(@PathVariable("planId") String planId) {
|
||||
return success(equSpotCheckService.selectEquPlanByPlanId(planId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增点检计划
|
||||
*/
|
||||
@RequiresPermissions("device:spotCheckPlan:add")
|
||||
@Log(title = "点检计划", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EquPlan equPlan) {
|
||||
return toAjax(equSpotCheckService.insertEquPlan(equPlan));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改点检计划
|
||||
*/
|
||||
@RequiresPermissions("device:spotCheckPlan:edit")
|
||||
@Log(title = "点检计划", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EquPlan equPlan) {
|
||||
return toAjax(equSpotCheckService.updateEquPlan(equPlan));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除点检计划
|
||||
*/
|
||||
@RequiresPermissions("device:spotCheckPlan:remove")
|
||||
@Log(title = "点检计划", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{planIds}")
|
||||
public AjaxResult remove(@PathVariable String[] planIds) {
|
||||
return toAjax(equSpotCheckService.deleteEquPlanByPlanIds(planIds));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.op.device.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import com.op.device.domain.EquPlan;
|
||||
import com.op.device.domain.EquPlanEqu;
|
||||
|
||||
/**
|
||||
* 点检计划Service接口
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-10-30
|
||||
*/
|
||||
public interface IEquSpotCheckService {
|
||||
|
||||
/**
|
||||
* 查询点检计划
|
||||
*
|
||||
* @param planId 点检计划主键
|
||||
* @return 点检计划
|
||||
*/
|
||||
public EquPlan selectEquPlanByPlanId(String planId);
|
||||
|
||||
/**
|
||||
* 查询点检计划列表
|
||||
*
|
||||
* @param equPlan 点检计划
|
||||
* @return 点检计划集合
|
||||
*/
|
||||
public List<EquPlan> selectEquPlanList(EquPlan equPlan);
|
||||
|
||||
/**
|
||||
* 新增点检计划
|
||||
*
|
||||
* @param equPlan 点检计划
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEquPlan(EquPlan equPlan);
|
||||
|
||||
/**
|
||||
* 修改点检计划
|
||||
*
|
||||
* @param equPlan 点检计划
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEquPlan(EquPlan equPlan);
|
||||
|
||||
/**
|
||||
* 批量删除点检计划
|
||||
*
|
||||
* @param planIds 需要删除的点检计划主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEquPlanByPlanIds(String[] planIds);
|
||||
|
||||
/**
|
||||
* 删除点检计划信息
|
||||
*
|
||||
* @param planId 点检计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEquPlanByPlanId(String planId);
|
||||
|
||||
/**
|
||||
* 处理计划-设备信息
|
||||
*
|
||||
* @param equPlanEquList
|
||||
* @return
|
||||
*/
|
||||
AjaxResult formatEquItem(List<EquPlanEqu> equPlanEquList);
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package com.op.device.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import com.op.device.domain.*;
|
||||
import com.op.device.mapper.EquCheckItemDetailMapper;
|
||||
import com.op.device.mapper.EquCheckItemMapper;
|
||||
import com.op.device.mapper.EquPlanMapper;
|
||||
import com.op.device.service.IEquSpotCheckService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.op.common.core.web.domain.AjaxResult.error;
|
||||
import static com.op.common.core.web.domain.AjaxResult.success;
|
||||
|
||||
@Service
|
||||
public class EquSpotCheckServiceImpl implements IEquSpotCheckService {
|
||||
|
||||
@Autowired
|
||||
private EquPlanMapper equPlanMapper;
|
||||
@Autowired
|
||||
private EquCheckItemMapper equCheckItemMapper;
|
||||
@Autowired
|
||||
private EquCheckItemDetailMapper equCheckItemDetailMapper;
|
||||
|
||||
/**
|
||||
* 处理计划-设备信息
|
||||
*
|
||||
* @param equPlanEquList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public AjaxResult formatEquItem(List<EquPlanEqu> equPlanEquList) {
|
||||
for (EquPlanEqu data : equPlanEquList) {
|
||||
|
||||
StringBuilder itemTempName = new StringBuilder();
|
||||
|
||||
// 获取检查项list
|
||||
List<EquCheckItem> equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode(),"spotInspection");
|
||||
if (equCheckItemList.size() > 0) {
|
||||
List<EquPlanDetail> detailList = new ArrayList<>();
|
||||
for (EquCheckItem checkItem : equCheckItemList) {
|
||||
EquPlanDetail detail = new EquPlanDetail();
|
||||
BeanUtils.copyProperties(checkItem,detail);
|
||||
|
||||
if (!detail.getItemCode().isEmpty()) {
|
||||
itemTempName.append(detail.getItemName()).append(",");
|
||||
// 获取检查项详情list
|
||||
List<EquCheckItemDetail> equCheckItemDetailList = equCheckItemDetailMapper.selectCheckItemDetailByItemCode(detail.getItemCode());
|
||||
if (equCheckItemList.size() > 0) {
|
||||
List<EquPlanStandard> standardList = new ArrayList<>();
|
||||
for (EquCheckItemDetail standardTemp : equCheckItemDetailList) {
|
||||
EquPlanStandard standard = new EquPlanStandard();
|
||||
BeanUtils.copyProperties(standardTemp,standard);
|
||||
|
||||
standard.setShowFlag(true);
|
||||
standardList.add(standard);
|
||||
}
|
||||
detail.setEquPlanStandardList(standardList);
|
||||
}
|
||||
}
|
||||
detailList.add(detail);
|
||||
}
|
||||
data.setEquPlanDetailList(detailList);
|
||||
data.setItemTempName(itemTempName.toString());
|
||||
}else {
|
||||
return error(500,"存在设备未设置点检项!");
|
||||
}
|
||||
}
|
||||
return success(equPlanEquList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询点检计划
|
||||
*
|
||||
* @param planId 点检计划主键
|
||||
* @return 点检计划
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public EquPlan selectEquPlanByPlanId(String planId) {
|
||||
return equPlanMapper.selectEquPlanByPlanId(planId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询点检计划列表
|
||||
*
|
||||
* @param equPlan 点检计划
|
||||
* @return 点检计划
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<EquPlan> selectEquPlanList(EquPlan equPlan) {
|
||||
return equPlanMapper.selectEquPlanList(equPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增点检计划
|
||||
*
|
||||
* @param equPlan 点检计划
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertEquPlan(EquPlan equPlan) {
|
||||
equPlan.setCreateTime(DateUtils.getNowDate());
|
||||
return equPlanMapper.insertEquPlan(equPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改点检计划
|
||||
*
|
||||
* @param equPlan 点检计划
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateEquPlan(EquPlan equPlan) {
|
||||
equPlan.setUpdateTime(DateUtils.getNowDate());
|
||||
return equPlanMapper.updateEquPlan(equPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除点检计划
|
||||
*
|
||||
* @param planIds 需要删除的点检计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquPlanByPlanIds(String[] planIds) {
|
||||
return equPlanMapper.deleteEquPlanByPlanIds(planIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除点检计划信息
|
||||
*
|
||||
* @param planId 点检计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquPlanByPlanId(String planId) {
|
||||
return equPlanMapper.deleteEquPlanByPlanId(planId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue