设备管理-检查项维护(修改)

highway
wws 1 year ago
parent 899f67ebd2
commit 5205fab4f9

@ -83,8 +83,8 @@ public class EquCheckItemController extends BaseController {
@RequiresPermissions("device:item:edit") @RequiresPermissions("device:item:edit")
@Log(title = "检查项维护", businessType = BusinessType.UPDATE) @Log(title = "检查项维护", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody EquCheckItem equCheckItem) { public AjaxResult edit(@RequestBody EquCheckItemDTO equCheckItemDTO) {
return toAjax(equCheckItemService.updateEquCheckItem(equCheckItem)); return equCheckItemService.updateEquCheckItem(equCheckItemDTO);
} }
/** /**

@ -5,6 +5,7 @@ import java.util.List;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquCheckItem; import com.op.device.domain.EquCheckItem;
import com.op.device.domain.dto.EquCheckItemDTO; import com.op.device.domain.dto.EquCheckItemDTO;
import com.op.device.domain.vo.EquCheckItemVO;
/** /**
* Service * Service
@ -19,7 +20,7 @@ public interface IEquCheckItemService {
* @param itemId * @param itemId
* @return * @return
*/ */
public EquCheckItem selectEquCheckItemByItemId(String itemId); public EquCheckItemVO selectEquCheckItemByItemId(String itemId);
/** /**
* *
@ -43,7 +44,7 @@ public interface IEquCheckItemService {
* @param equCheckItem * @param equCheckItem
* @return * @return
*/ */
public int updateEquCheckItem(EquCheckItem equCheckItem); public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO);
/** /**
* *

@ -1,5 +1,6 @@
package com.op.device.service.impl; package com.op.device.service.impl;
import java.text.Format;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.List; import java.util.List;
@ -12,6 +13,7 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.common.log.annotation.Log; import com.op.common.log.annotation.Log;
import com.op.device.domain.EquCheckItemDetail; import com.op.device.domain.EquCheckItemDetail;
import com.op.device.domain.dto.EquCheckItemDTO; import com.op.device.domain.dto.EquCheckItemDTO;
import com.op.device.domain.vo.EquCheckItemVO;
import com.op.device.mapper.EquCheckItemDetailMapper; import com.op.device.mapper.EquCheckItemDetailMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -48,8 +50,16 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public EquCheckItem selectEquCheckItemByItemId(String itemId) { public EquCheckItemVO selectEquCheckItemByItemId(String itemId) {
return equCheckItemMapper.selectEquCheckItemByItemId(itemId); EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(itemId);
// 创建返回对象
EquCheckItemVO equCheckItemVO = new EquCheckItemVO();
BeanUtils.copyProperties(equCheckItem,equCheckItemVO);
equCheckItemVO.setFormStandard(equCheckItemDetailMapper.selectEquCheckItemDetailByParentCode(equCheckItem.getItemCode()));
return equCheckItemVO;
} }
/** /**
@ -154,13 +164,36 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
/** /**
* *
* *
* @param equCheckItem * @param equCheckItemDTO
* @return * @return
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public int updateEquCheckItem(EquCheckItem equCheckItem) { public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) {
return equCheckItemMapper.updateEquCheckItem(equCheckItem); EquCheckItem equCheckItem = new EquCheckItem();
BeanUtils.copyProperties(equCheckItemDTO,equCheckItem);
// 处理检查项信息
equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName());
equCheckItem.setUpdatedTime(DateUtils.getNowDate());
if (equCheckItem.getItemType().equals("spotInspection")) {
equCheckItem.setItemTypeName("点检");
}
if (equCheckItem.getItemType().equals("inspection")) {
equCheckItem.setItemTypeName("巡检");
}
if (equCheckItem.getItemType().equals("maintenance")) {
equCheckItem.setItemTypeName("保养");
}
equCheckItemMapper.updateEquCheckItem(equCheckItem);
for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) {
detail.setUpdatedBy(SecurityContextHolder.getUserName());
detail.setUpdatedTime(DateUtils.getNowDate());
equCheckItemDetailMapper.updateEquCheckItemDetail(detail);
}
return success("修改成功");
} }
/** /**

Loading…
Cancel
Save