|
@@ -3,6 +3,7 @@ package com.platform.rest.controller.check;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.platform.common.util.R;
|
|
|
import com.platform.dao.dto.check.CheckJobDTO;
|
|
|
+import com.platform.dao.dto.check.CheckStandardBatchDTO;
|
|
|
import com.platform.dao.dto.check.CheckStandardDTO;
|
|
|
import com.platform.dao.entity.check.CheckStandard;
|
|
|
import com.platform.dao.vo.export.check.ExportCheckStandardVO2;
|
|
@@ -38,18 +39,18 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
@RequestMapping("/check/standards")
|
|
|
public class CheckStandardController {
|
|
|
|
|
|
- private final CheckStandardService checkStandardService;
|
|
|
+ private final CheckStandardService checkStandardService;
|
|
|
|
|
|
- /**
|
|
|
- * 通过id查询单条记录
|
|
|
- *
|
|
|
- * @param projectId 主键
|
|
|
- * @return R
|
|
|
- */
|
|
|
- @GetMapping("/project/{id}")
|
|
|
- public R<CheckStandard> getByProjectId(@PathVariable("id") String projectId){
|
|
|
- return new R(checkStandardService.selectProjectStandardList(projectId));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 通过id查询单条记录
|
|
|
+ *
|
|
|
+ * @param projectId 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/project/{id}")
|
|
|
+ public R<CheckStandard> getByProjectId(@PathVariable("id") String projectId) {
|
|
|
+ return new R(checkStandardService.selectProjectStandardList(projectId));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 通过projectid查询多条标准
|
|
@@ -58,36 +59,50 @@ public class CheckStandardController {
|
|
|
* @return R
|
|
|
*/
|
|
|
@GetMapping("/{id}")
|
|
|
- public R<CheckStandard> getById(@PathVariable("id") String id){
|
|
|
+ public R<CheckStandard> getById(@PathVariable("id") String id) {
|
|
|
return new R<>(checkStandardService.getModelById(id));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 新增记录
|
|
|
- *
|
|
|
- * @param checkStandardDTO 保养标准DTO
|
|
|
- * @return R
|
|
|
- */
|
|
|
- @SysLog("新增保养标准")
|
|
|
- @PostMapping
|
|
|
- @PreAuthorize("@pms.hasPermission('check-spot-standards-add') or @pms.hasPermission('check-spot-standards-add')")
|
|
|
- public R save(@Validated({AddGroup.class}) @RequestBody CheckStandardDTO checkStandardDTO) {
|
|
|
- return new R<>(checkStandardService.saveModelByDTO(checkStandardDTO));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 新增记录
|
|
|
+ *
|
|
|
+ * @param checkStandardDTO 保养标准DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("新增保养标准")
|
|
|
+ @PostMapping
|
|
|
+ @PreAuthorize("@pms.hasPermission('check-spot-standards-add') or @pms.hasPermission('check-spot-standards-add')")
|
|
|
+ public R save(@Validated({AddGroup.class}) @RequestBody CheckStandardDTO checkStandardDTO) {
|
|
|
+ return new R<>(checkStandardService.saveModelByDTO(checkStandardDTO));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 修改记录
|
|
|
- *
|
|
|
- * @param checkStandardDTO 保养标准DTO
|
|
|
- * @return R
|
|
|
- */
|
|
|
- @SysLog("修改保养标准")
|
|
|
- @PutMapping("/{id}")
|
|
|
- @PreAuthorize("@pms.hasPermission('check-spot-standards-edit')")
|
|
|
- public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CheckStandardDTO checkStandardDTO) {
|
|
|
- checkStandardService.modModelByDTO(checkStandardDTO);
|
|
|
- return new R<>();
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 修改记录
|
|
|
+ *
|
|
|
+ * @param checkStandardDTO 保养标准DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("修改保养标准")
|
|
|
+ @PutMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('check-spot-standards-edit')")
|
|
|
+ public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CheckStandardDTO checkStandardDTO) {
|
|
|
+ checkStandardService.modModelByDTO(checkStandardDTO);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量新增和修改
|
|
|
+ *
|
|
|
+ * @param checkStandardBatchDTO 明细列表
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("批量新增和修改")
|
|
|
+ @PostMapping("/batch")
|
|
|
+ @PreAuthorize("@pms.hasPermission('check-spot-standards-edit')")
|
|
|
+ public R batch(@Validated({UpdateGroup.class}) @RequestBody CheckStandardBatchDTO checkStandardBatchDTO) {
|
|
|
+ checkStandardService.batch(checkStandardBatchDTO);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 初始化编码
|
|
@@ -99,10 +114,10 @@ public class CheckStandardController {
|
|
|
@PreAuthorize("@pms.hasPermission('check-spot-standards-edit')")
|
|
|
public R updateNo() {
|
|
|
List<CheckStandardVO> checkStandardVOList = checkStandardService.selectList(new CheckStandardDTO());
|
|
|
- if(CollectionUtil.isNotEmpty(checkStandardVOList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(checkStandardVOList)) {
|
|
|
List<CheckStandard> checkStandardList = new ArrayList<CheckStandard>();
|
|
|
int i = 1;
|
|
|
- for(CheckStandardVO vo: checkStandardVOList){
|
|
|
+ for (CheckStandardVO vo : checkStandardVOList) {
|
|
|
CheckStandard checkStandard = new CheckStandard();
|
|
|
checkStandard.setId(vo.getId());
|
|
|
checkStandard.setNo(String.format("%05d", i++));
|
|
@@ -149,19 +164,19 @@ public class CheckStandardController {
|
|
|
return new R<>(checkStandardService.getCountByDTO(checkStandardDTO));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 通过id删除一条记录
|
|
|
- *
|
|
|
- * @param id 主键
|
|
|
- * @return R
|
|
|
- */
|
|
|
- @SysLog("删除保养标准")
|
|
|
- @DeleteMapping("/{id}")
|
|
|
- @PreAuthorize("@pms.hasPermission('check-spot-standards-del') or @pms.hasPermission('check-spot-standards-del')")
|
|
|
- public R removeById(@PathVariable String id){
|
|
|
- checkStandardService.deleteByPrimaryKey(id);
|
|
|
- return new R<>();
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 通过id删除一条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("删除保养标准")
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('check-spot-standards-del') or @pms.hasPermission('check-spot-standards-del')")
|
|
|
+ public R removeById(@PathVariable String id) {
|
|
|
+ checkStandardService.deleteByPrimaryKey(id);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 批量记录
|
|
@@ -172,69 +187,67 @@ public class CheckStandardController {
|
|
|
@SysLog("批量删除保养标准")
|
|
|
@DeleteMapping("")
|
|
|
@PreAuthorize("@pms.hasPermission('check-spot-standards-del')")
|
|
|
- public R removeIds(@RequestBody List<String> ids){
|
|
|
+ public R removeIds(@RequestBody List<String> ids) {
|
|
|
checkStandardService.batchDelete(ids);
|
|
|
return new R<>();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取分页
|
|
|
- *
|
|
|
- * @param pageNum 当前页码
|
|
|
- * @param pageSize 每页条数
|
|
|
- * @param checkStandardDTO 保养标准DTO
|
|
|
- * @return R
|
|
|
- */
|
|
|
- @GetMapping("/page")
|
|
|
- public R<AbstractPageResultBean<CheckStandard>> query(CheckStandardDTO checkStandardDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
|
|
|
- return new R<>(checkStandardService.selectPageInfo(checkStandardDTO, pageNum, pageSize));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 获取分页
|
|
|
+ *
|
|
|
+ * @param pageNum 当前页码
|
|
|
+ * @param pageSize 每页条数
|
|
|
+ * @param checkStandardDTO 保养标准DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ public R<AbstractPageResultBean<CheckStandard>> query(CheckStandardDTO checkStandardDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
|
|
|
+ return new R<>(checkStandardService.selectPageInfo(checkStandardDTO, pageNum, pageSize));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 获取列表
|
|
|
- *
|
|
|
- * @param checkStandardDTO 保养标准DTO
|
|
|
- * @return R
|
|
|
- */
|
|
|
- @GetMapping("")
|
|
|
- public R query(CheckStandardDTO checkStandardDTO) {
|
|
|
- return new R<>(checkStandardService.selectList(checkStandardDTO));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 获取列表
|
|
|
+ *
|
|
|
+ * @param checkStandardDTO 保养标准DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("")
|
|
|
+ public R query(CheckStandardDTO checkStandardDTO) {
|
|
|
+ return new R<>(checkStandardService.selectList(checkStandardDTO));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 保养标准导出
|
|
|
*
|
|
|
* @param checkStandardDTO 保养标准DTO
|
|
|
* @return R
|
|
|
*/
|
|
|
- @GetMapping("/export")
|
|
|
- @SysLog("保养标准导出")
|
|
|
- public void export(HttpServletResponse response, CheckStandardDTO checkStandardDTO) {
|
|
|
- List<CheckStandardVO> list = checkStandardService.selectList(checkStandardDTO);
|
|
|
- ExcelUtil.exportResponseDict(response, ExportCheckStandardVO2.class, BeanConverterUtil.copyListProperties(list, ExportCheckStandardVO2.class), "保养标准");
|
|
|
- }
|
|
|
+ @GetMapping("/export")
|
|
|
+ @SysLog("保养标准导出")
|
|
|
+ public void export(HttpServletResponse response, CheckStandardDTO checkStandardDTO) {
|
|
|
+ List<CheckStandardVO> list = checkStandardService.selectList(checkStandardDTO);
|
|
|
+ ExcelUtil.exportResponseDict(response, ExportCheckStandardVO2.class, BeanConverterUtil.copyListProperties(list, ExportCheckStandardVO2.class), "保养标准");
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 导入保养标准(包括修改,新增,删除)
|
|
|
*
|
|
|
* @param
|
|
|
- *
|
|
|
* @return R
|
|
|
*/
|
|
|
@SysLog("新增导入设备的保养标准")
|
|
|
@PostMapping("/import/execute")
|
|
|
- public R importList( @RequestParam("file") MultipartFile file) throws Exception {
|
|
|
+ public R importList(@RequestParam("file") MultipartFile file) throws Exception {
|
|
|
checkStandardService.importList(file);
|
|
|
return new R();
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@SysLog("导入设备的保养标准")
|
|
|
- @PostMapping(value="/import",headers = "content-type=multipart/form-data")
|
|
|
- public R importListByAdd( @RequestParam("files") MultipartFile[] files) throws Exception {
|
|
|
- String result ="";
|
|
|
- for(MultipartFile file: files){
|
|
|
+ @PostMapping(value = "/import", headers = "content-type=multipart/form-data")
|
|
|
+ public R importListByAdd(@RequestParam("files") MultipartFile[] files) throws Exception {
|
|
|
+ String result = "";
|
|
|
+ for (MultipartFile file : files) {
|
|
|
result = result + checkStandardService.importListByAdd(file);
|
|
|
}
|
|
|
return new R<>(result);
|
|
@@ -244,14 +257,13 @@ public class CheckStandardController {
|
|
|
* 导入保养标准老版本
|
|
|
*
|
|
|
* @param files bom excel文件
|
|
|
- *
|
|
|
* @return R
|
|
|
*/
|
|
|
@SysLog("新增导入设备的保养标准")
|
|
|
- @PostMapping(value="/import/old",headers = "content-type=multipart/form-data")
|
|
|
- public R importListByAddOldVersion( @RequestParam("files") MultipartFile[] files) throws Exception {
|
|
|
- String result ="";
|
|
|
- for(MultipartFile file: files){
|
|
|
+ @PostMapping(value = "/import/old", headers = "content-type=multipart/form-data")
|
|
|
+ public R importListByAddOldVersion(@RequestParam("files") MultipartFile[] files) throws Exception {
|
|
|
+ String result = "";
|
|
|
+ for (MultipartFile file : files) {
|
|
|
result = result + checkStandardService.importListByAddOldVersion(file);
|
|
|
}
|
|
|
return new R<>(result);
|
|
@@ -261,14 +273,13 @@ public class CheckStandardController {
|
|
|
* 导入保养标准
|
|
|
*
|
|
|
* @param files bom excel文件
|
|
|
- *
|
|
|
* @return R
|
|
|
*/
|
|
|
@SysLog("修改导入设备的保养标准执行时间")
|
|
|
- @PostMapping(value="/import/update",headers = "content-type=multipart/form-data")
|
|
|
- public R importListByUpdate( @RequestParam("files") MultipartFile[] files) throws Exception {
|
|
|
- String result ="";
|
|
|
- for(MultipartFile file: files){
|
|
|
+ @PostMapping(value = "/import/update", headers = "content-type=multipart/form-data")
|
|
|
+ public R importListByUpdate(@RequestParam("files") MultipartFile[] files) throws Exception {
|
|
|
+ String result = "";
|
|
|
+ for (MultipartFile file : files) {
|
|
|
result = result + checkStandardService.importListByUpdate(file);
|
|
|
}
|
|
|
return new R<>(result);
|