点检计划

highway
wws 11 months ago
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);
}

@ -126,7 +126,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
/**
* TODO
*
*
* @param equOrder
* @return

@ -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);
}
}

@ -67,7 +67,7 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService {
}
/**
* TODO
*
*
* @param equPlan
* @return
@ -213,7 +213,7 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService {
}
/**
* TODO
*
*
* @param equPlan
* @param factory

Loading…
Cancel
Save