|
@@ -10,8 +10,14 @@ import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
+import org.jeecg.modules.cmmsSpotcheckContent.convert.CmmsSpotcheckContentConvert;
|
|
|
|
+import org.jeecg.modules.cmmsSpotcheckContent.dto.CmmsSpotcheckContentAddDTO;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
|
|
|
|
+import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
|
|
|
|
+import org.jeecg.modules.cmmsSpotcheckContentItem.service.ICmmsSpotcheckContentItemService;
|
|
|
|
+import org.jeecg.modules.util.AutoCodeUtil;
|
|
|
|
+import org.jeecg.modules.util.UserConstants;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
@@ -19,6 +25,10 @@ import org.springframework.web.servlet.ModelAndView;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 点检内容
|
|
* @Description: 点检内容
|
|
@@ -33,6 +43,10 @@ import java.util.Arrays;
|
|
public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotcheckContent, ICmmsSpotcheckContentService> {
|
|
public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotcheckContent, ICmmsSpotcheckContentService> {
|
|
@Autowired
|
|
@Autowired
|
|
private ICmmsSpotcheckContentService cmmsSpotcheckContentService;
|
|
private ICmmsSpotcheckContentService cmmsSpotcheckContentService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private AutoCodeUtil autoCodeUtil;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICmmsSpotcheckContentItemService spotcheckContentItemService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 如果要修改该点检内容状态为“启用”,那该设备的其他点检项都停掉
|
|
* 如果要修改该点检内容状态为“启用”,那该设备的其他点检项都停掉
|
|
@@ -86,17 +100,26 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 添加
|
|
|
|
|
|
+ * 点检内容——新增
|
|
*
|
|
*
|
|
- * @param cmmsSpotcheckContent
|
|
|
|
|
|
+ * @param dto
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @AutoLog(value = "点检内容-添加")
|
|
|
|
- @ApiOperation(value="点检内容-添加", notes="点检内容-添加")
|
|
|
|
|
|
+ @AutoLog(value = "点检内容——新增")
|
|
|
|
+ @ApiOperation(value="点检内容——新增", notes="点检内容——新增——同时新增多个点检项-点检内容")
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:add")
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:add")
|
|
@PostMapping(value = "/add")
|
|
@PostMapping(value = "/add")
|
|
- public Result<String> add(@RequestBody CmmsSpotcheckContent cmmsSpotcheckContent) {
|
|
|
|
|
|
+ public Result<String> add(@RequestBody CmmsSpotcheckContentAddDTO dto) {
|
|
|
|
+ CmmsSpotcheckContent cmmsSpotcheckContent = CmmsSpotcheckContentConvert.INSTANCE.convert(dto);
|
|
|
|
+ if (cmmsSpotcheckContent.getContentcode() == null || "".equals(cmmsSpotcheckContent.getContentcode())) {
|
|
|
|
+ cmmsSpotcheckContent.setContentcode(autoCodeUtil.genSerialCode(UserConstants.CMMSSPOTCHECKCONTENT_CODE, null));
|
|
|
|
+ }
|
|
cmmsSpotcheckContentService.save(cmmsSpotcheckContent);
|
|
cmmsSpotcheckContentService.save(cmmsSpotcheckContent);
|
|
|
|
+ List<CmmsSpotcheckContentItem> contentItemList = dto.getSpotcheckContentItemList();
|
|
|
|
+ if (contentItemList != null && contentItemList.size() > 0) {
|
|
|
|
+ contentItemList.stream().map(i->i.setSpotcheckcontid(cmmsSpotcheckContent.getId())).collect(Collectors.toList());
|
|
|
|
+ spotcheckContentItemService.saveBatch(contentItemList);
|
|
|
|
+ }
|
|
return Result.OK("添加成功!");
|
|
return Result.OK("添加成功!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -126,6 +149,9 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:delete")
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:delete")
|
|
@DeleteMapping(value = "/delete")
|
|
@DeleteMapping(value = "/delete")
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
|
+ Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
+ columnMap.put("spotcheckcontid",id);
|
|
|
|
+ spotcheckContentItemService.removeByMap(columnMap);
|
|
cmmsSpotcheckContentService.removeById(id);
|
|
cmmsSpotcheckContentService.removeById(id);
|
|
return Result.OK("删除成功!");
|
|
return Result.OK("删除成功!");
|
|
}
|
|
}
|
|
@@ -141,6 +167,11 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:deleteBatch")
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:deleteBatch")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
|
+ for (String id: Arrays.asList(ids.split(","))){
|
|
|
|
+ Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
+ columnMap.put("spotcheckcontid",id);
|
|
|
|
+ spotcheckContentItemService.removeByMap(columnMap);
|
|
|
|
+ }
|
|
this.cmmsSpotcheckContentService.removeByIds(Arrays.asList(ids.split(",")));
|
|
this.cmmsSpotcheckContentService.removeByIds(Arrays.asList(ids.split(",")));
|
|
return Result.OK("批量删除成功!");
|
|
return Result.OK("批量删除成功!");
|
|
}
|
|
}
|