123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package com.siwei.apply.controller;
- import com.siwei.apply.domain.res.TjyydhxRes;
- import com.siwei.apply.domain.vo.TjyydhxUpdateVo;
- import com.siwei.apply.domain.vo.TjyydhxVo;
- import com.siwei.apply.service.ProjectService;
- import com.siwei.apply.service.TjyydhxService;
- import com.siwei.common.core.domain.R;
- import com.siwei.common.core.web.controller.BaseController;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.HashMap;
- import java.util.Map;
- /**
- * 规划条件与用地红线出具 控制器
- * 批次报批第一步
- */
- @RestController
- @RequestMapping("/tjyydhx")
- public class TjyydhxController extends BaseController {
- @Autowired
- private TjyydhxService tjyydhxService;
- @Autowired
- private ProjectService projectService;
- /**
- * 添加规划条件与用地红线出具
- */
- @PostMapping()
- public R<Map> Add(@RequestBody TjyydhxVo tjyydhxVo) {
- try {
- Boolean b = tjyydhxService.isExit(tjyydhxVo.getProjectId());
- if (b == true) {
- return R.fail("此项目已添加规划条件与用地红线出具");
- }
- String id = tjyydhxService.add(tjyydhxVo);
- Map<String, String> map = new HashMap<>();
- map.put("id", id);
- return R.ok(map);
- } catch (Exception e) {
- return R.fail(e.getMessage());
- }
- }
- /**
- * 获取规划条件与用地红线出具
- *
- * @param projectId 项目ID
- * @return 规划条件与用地红线出具
- */
- @GetMapping("/{projectId}")
- public R<TjyydhxRes> Get(@PathVariable String projectId) {
- try {
- return R.ok(tjyydhxService.get(projectId));
- } catch (Exception e) {
- return R.fail(e.getMessage());
- }
- }
- /**
- * 通过主键id获取规划条件与用地红线出具,返回结果与按projectId查询一致
- */
- @GetMapping("/id/{id}")
- public R<TjyydhxRes> GetById(@PathVariable String id) {
- try {
- return R.ok(tjyydhxService.getById(id));
- } catch (Exception e) {
- return R.fail(e.getMessage());
- }
- }
- /**
- * 更新规划条件与用地红线出具
- *
- * @param tjyydhxUpdateVo 规划条件与用地红线出具
- * @return 操作结果
- */
- @PutMapping()
- public R<Void> Update(@RequestBody TjyydhxUpdateVo tjyydhxUpdateVo) {
- try {
- tjyydhxService.update(tjyydhxUpdateVo);
- return R.ok();
- } catch (Exception e) {
- return R.fail(e.getMessage());
- }
- }
- /**
- * 这里没有校验空间数据,是因为(流程第二项t_ydbp 表中对应的地块信息,如果按顺序流程,则第一项未上链,则第二一定无值,校验没有意义)
- * 更新规划条件与用地红线出具的上链状态
- */
- @PutMapping("/onchain")
- public R<Void> updateHasOnchain(@RequestBody Map<String, Object> params) {
- try {
- String id = (String) params.get("id");
- String projectId = (String) params.get("projectId");
- Boolean hasOnchain = (Boolean) params.get("hasOnchain");
- if (StringUtils.isBlank(id)) {
- return R.fail("nodeId不能为空");
- }
- tjyydhxService.updateHasOnchain(id, hasOnchain);
- // 更新项目表的上链数量
- projectService.countOnChinaNum(projectId);
- return R.ok();
- } catch (Exception e) {
- return R.fail(e.getMessage());
- }
- }
- }
|