| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrIrrigate.project; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.aop.SsoAop; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponse; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.common.webUtil.ResultCodeMsg; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrProject; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoProject; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoProjectDetail; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoProjectOne; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoProjectSimple; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoActiveCard; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.project.dto.IrrigateProject; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.result.IrrigateResultCode; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.Operation; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Content; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.responses.ApiResponse; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.responses.ApiResponses; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.tags.Tag; | 
|---|
|  |  |  | import jakarta.validation.Valid; | 
|---|
|  |  |  | import lombok.RequiredArgsConstructor; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.http.MediaType; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.validation.BindingResult; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  | import java.util.Optional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author :WuZeYu | 
|---|
|  |  |  | * @Date :2024/5/14  13:53 | 
|---|
|  |  |  | * @LastEditTime :2024/5/14  13:53 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Tag(name = "项目管理", description = "项目操作") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(path = "project") | 
|---|
|  |  |  | @RequiredArgsConstructor | 
|---|
|  |  |  | public class ProjectCtrl { | 
|---|
|  |  |  | private final ProjectSv projectSv; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加项目,旧版本,原则上废弃 | 
|---|
|  |  |  | * @param po            项目实体对象 | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return 添加是否成功 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "添加项目记录", description = "添加项目记录") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "操作结果:true:成功,false:失败(BaseResponse.content)", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> add(@RequestBody @Valid IrProject po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(projectSv.addProject(po)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("添加项目异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 逻辑删除项目,旧版本,原则上废弃 | 
|---|
|  |  |  | * @param map | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "逻辑删除项目", description = "逻辑删除项目") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "操作结果:true:成功,false:失败(BaseResponse.content)", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> delete(@RequestBody Map map) { | 
|---|
|  |  |  | if (map == null || map.size() <= 0) { | 
|---|
|  |  |  | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Long projectId = Long.parseLong(map.get("id").toString()); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rows = projectSv.deleteProject(projectId); | 
|---|
|  |  |  | if (rows == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("删除项目异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 批量删除 | 
|---|
|  |  |  | * @param projectIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "delete_batch", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> delete_batch(@RequestBody Map<String,List> projectIds) { | 
|---|
|  |  |  | if (projectIds == null || projectIds.size() <= 0) { | 
|---|
|  |  |  | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List ids = projectIds.get("projectIds"); | 
|---|
|  |  |  | for (int i = 0; i < ids.size(); i++) { | 
|---|
|  |  |  | long projectId = Long.parseLong(ids.get(i).toString()); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rows = projectSv.deleteProject(projectId); | 
|---|
|  |  |  | if (rows == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("删除项目异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改项目信息,旧版本,原则上废弃 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "修改项目信息", description = "修改项目信息") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "操作结果:true:成功,false:失败(BaseResponse.content)", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> update(@RequestBody @Valid IrProject po, BindingResult bindingResult){ | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(projectSv.updateProject(po)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("修改项目异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改项目状态,无用接口,原则上废弃 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "修改项目状态", description = "修改项目状态") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "操作结果:true:成功,false:失败(BaseResponse.content)", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "update_state", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> update_state(@RequestBody IrProject po){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(projectSv.updateProjectState(po)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("修改项目异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取一个项目数据,旧版本,原则上废弃 | 
|---|
|  |  |  | * @return 获取一个项目数据 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "获取一个项目数据", description = "获取一个项目数据") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "获取一个项目数据(BaseResponse.content:{})", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = IrProject.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(path = "one") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<VoProjectOne> one(@RequestParam Long id) { | 
|---|
|  |  |  | VoProjectOne irProject = this.projectSv.selectById(id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(irProject); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分页查询,旧版本,原则上废弃 | 
|---|
|  |  |  | * @param vo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "获得一页项目记录", description = "获得一页项目记录") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "获得一页项目记录(BaseResponse.content:QueryResultVo[{}])", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = VoActiveCard.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(path = "some") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoProject>>> getProjects(QueryVo vo) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | QueryResultVo<List<VoProject>> res = projectSv.getProjects(vo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取项目记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加项目,新版本,使用这个 | 
|---|
|  |  |  | * @param po            项目实体对象 | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return 添加是否成功 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "addIrrigateProject", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> addIrrigateProject(@RequestBody @Valid IrrigateProject po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = projectSv.addIrrigateProject(po); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //String projectName = po.getProjectName(); | 
|---|
|  |  |  | //String irrigateGroups = po.getIrrigateGroups(); | 
|---|
|  |  |  | //Long operatorId = po.getOperatorId(); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //IrProject irProject = new IrProject(); | 
|---|
|  |  |  | //irProject.setProjectName(projectName); | 
|---|
|  |  |  | //irProject.setProjectState((byte)1); | 
|---|
|  |  |  | //irProject.setOperator(operatorId); | 
|---|
|  |  |  | //irProject.setOperateTime(new Date()); | 
|---|
|  |  |  | //irProject.setDeleted((byte)0); | 
|---|
|  |  |  | //Long projectId = projectSv.addIrrigateProject(irProject); | 
|---|
|  |  |  | //if(projectId == null) { | 
|---|
|  |  |  | //    return BaseResponseUtils.buildErrorMsg("创建灌溉项目失败"); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //String[] irrigateGroupArr = irrigateGroups.split(","); | 
|---|
|  |  |  | //Integer sort = 1; | 
|---|
|  |  |  | //for(String irrigateGroupId : irrigateGroupArr) { | 
|---|
|  |  |  | //    String trimmed = irrigateGroupId.trim(); | 
|---|
|  |  |  | //    if(trimmed.isEmpty()) { | 
|---|
|  |  |  | //        continue; | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //    try { | 
|---|
|  |  |  | //        Long irrigateGroupIdLong = Long.parseLong(trimmed); | 
|---|
|  |  |  | //        IrProjectGroup irProjectGroup = new IrProjectGroup(); | 
|---|
|  |  |  | //        irProjectGroup.setProjectId(projectId); | 
|---|
|  |  |  | //        irProjectGroup.setGroupId(irrigateGroupIdLong); | 
|---|
|  |  |  | //        irProjectGroup.setSort(sort++); | 
|---|
|  |  |  | //        projectSv.projectBindGroup(irProjectGroup); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    } catch (NumberFormatException  e) { | 
|---|
|  |  |  | //        return BaseResponseUtils.buildErrorMsg("灌溉组ID格式错误"); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除项目,新版本,使用这个 | 
|---|
|  |  |  | * @param projectId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "deleteIrrigateProject") | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> deleteIrrigateProject(@RequestParam(required = false) Long projectId) { | 
|---|
|  |  |  | if(projectId == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("项目ID不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = projectSv.deleteIrrigateProject(projectId); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改项目,新版本,使用这个 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "updateIrrigateProject", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> updateIrrigateProject(@RequestBody @Valid IrrigateProject po, BindingResult bindingResult){ | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(po.getProjectId() == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("项目ID不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = projectSv.updateIrrigateProject(po); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分页查询项目,新版本,目前使用 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getSimpleProjects") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoProjectSimple>>> getSimpleProjects(QueryVo qo) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | QueryResultVo<List<VoProjectSimple>> res = projectSv.getSimpleProjects(qo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取项目记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据项目Id获取项目详情,编辑项目信息使用 | 
|---|
|  |  |  | * @param projectId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "getProject") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<VoProjectDetail> getProject(@RequestParam Long projectId) { | 
|---|
|  |  |  | if(projectId == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("项目ID不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = projectSv.getProjectDetail(projectId); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(map_result.get("content")) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|