TdhyhsController.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package com.siwei.apply.controller;
  2. import com.siwei.apply.domain.res.TdhyhsRes;
  3. import com.siwei.apply.domain.vo.TdhyhsUpdateVo;
  4. import com.siwei.apply.domain.vo.TdhyhsVo;
  5. import com.siwei.apply.service.TdhyhsService;
  6. import com.siwei.common.core.domain.R;
  7. import com.siwei.common.core.web.controller.BaseController;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.HashMap;
  11. import java.util.Map;
  12. /**
  13. * 土地核验与规划核实 控制器
  14. * 单独选址第七步
  15. * 批次跑批第六步
  16. */
  17. @RestController
  18. @RequestMapping("/tdhyhs")
  19. public class TdhyhsController extends BaseController {
  20. @Autowired
  21. private TdhyhsService tdhyhsService;
  22. /**
  23. * 添加土地核验与规划核实
  24. */
  25. @PostMapping()
  26. public R<Map> Add(@RequestBody TdhyhsVo tdhyhsVo) {
  27. try {
  28. // Boolean b = tdhyhsService.isExit(tdhyhsVo.getProjectId());
  29. // if (b == true) {
  30. // return R.fail("此项目已添加土地核验与规划核实");
  31. // }
  32. String id = tdhyhsService.add(tdhyhsVo);
  33. Map<String, String> map = new HashMap<>();
  34. map.put("id", id);
  35. return R.ok(map);
  36. } catch (Exception e) {
  37. return R.fail(e.getMessage());
  38. }
  39. }
  40. /**
  41. * 获取土地核验与规划核实
  42. *
  43. * @param projectId 项目ID
  44. * @return 土地核验与规划核实
  45. */
  46. @GetMapping("/{projectId}")
  47. public R<TdhyhsRes> Get(@PathVariable String projectId) {
  48. try {
  49. return R.ok(tdhyhsService.get(projectId));
  50. } catch (Exception e) {
  51. return R.fail(e.getMessage());
  52. }
  53. }
  54. /**
  55. * 更新土地核验与规划核实
  56. *
  57. * @param tdhyhsUpdateVo 土地核验与规划核实
  58. * @return 操作结果
  59. */
  60. @PutMapping()
  61. public R<Void> Update(@RequestBody TdhyhsUpdateVo tdhyhsUpdateVo) {
  62. try {
  63. tdhyhsService.update(tdhyhsUpdateVo);
  64. return R.ok();
  65. } catch (Exception e) {
  66. return R.fail(e.getMessage());
  67. }
  68. }
  69. /**
  70. * 更新土地核验与规划核实的上链状态
  71. */
  72. @PutMapping("/onchain")
  73. public R<Void> updateHasOnchain(@RequestBody Map<String, Object> params) {
  74. try {
  75. String id = (String) params.get("id");
  76. Boolean hasOnchain = (Boolean) params.get("hasOnchain");
  77. tdhyhsService.updateHasOnchain(id, hasOnchain);
  78. return R.ok();
  79. } catch (Exception e) {
  80. return R.fail(e.getMessage());
  81. }
  82. }
  83. }