|  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.common.webUtil.ResultCodeMsg; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrGroupClient; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoGroup; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoGroupDetail; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoGroupOne; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoUnit; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoUnitOne; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoGroupSimple; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoActiveCard; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.irrigateUnit.IrrigateUnitSv; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.irrigateGroup.QueryVo; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.irrigateGroup.dto.GroupClient; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.irrigateGroup.dto.IrrigateGroup; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.irrigateGroup.qo.QoGroup; | 
|---|
|  |  |  | import com.dy.pipIrrIrrigate.result.IrrigateResultCode; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.Operation; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Content; | 
|---|
|  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.addIrrigateGroup(po)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_GROUP_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("创建轮灌组异常", e); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 逻辑删除灌溉单元 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> delete(@RequestBody Map map) { | 
|---|
|  |  |  | if (map == null || map.size() <= 0) { | 
|---|
|  |  |  | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); | 
|---|
|  |  |  | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_GROUP_ID.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Long groupId = Long.parseLong(map.get("id").toString()); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rows = irrigateGroupSv.deleteIrrigateGroup(groupId); | 
|---|
|  |  |  | if (rows == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_GROUP_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("删除轮灌组异常", e); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 批量删除 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param groupIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rows = irrigateGroupSv.deleteIrrigateGroup(groupId); | 
|---|
|  |  |  | if (rows == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_GROUP_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("删除轮灌组异常", e); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改灌溉单元 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> update(@RequestBody @Valid IrIrrigateGroup po, BindingResult bindingResult){ | 
|---|
|  |  |  | public BaseResponse<Boolean> update(@RequestBody @Valid IrIrrigateGroup po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.updateIrrigateGroup(po)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_GROUP_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("修改轮灌组异常", e); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分页查询 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param vo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(path = "add_unit", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> addGroupUnit(@RequestBody @Valid Map<String,Object> po, BindingResult bindingResult) { | 
|---|
|  |  |  | public BaseResponse<Boolean> addGroupUnit(@RequestBody @Valid Map<String, Object> po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | irGroupUnit.setOperator(operator); | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(irGroupUnit)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.GROUP_ADD_UNIT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *  轮灌组移除灌溉单元 | 
|---|
|  |  |  | * 轮灌组移除灌溉单元 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(path = "remove_unit") | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> deleteGroupUnit(@RequestBody @Valid Map<String,Object> po, BindingResult bindingResult) { | 
|---|
|  |  |  | public BaseResponse<Boolean> deleteGroupUnit(@RequestBody @Valid Map<String, Object> po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改轮灌组绑定的灌溉单元 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(path = "updateBindUnits", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> updateBindUnits(@RequestBody @Valid Map<String,Object> po, BindingResult bindingResult){ | 
|---|
|  |  |  | public BaseResponse<Boolean> updateBindUnits(@RequestBody @Valid Map<String, Object> po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Long groupId = Long.parseLong(po.get("groupId").toString()); | 
|---|
|  |  |  | Long operator = Long.parseLong(po.get("operator").toString()); | 
|---|
|  |  |  | List<Long> newUnitIds = (List<Long>) po.get("unitIds"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<String> newUnitIds = (List<String>) po.get("unitIds"); | 
|---|
|  |  |  | List<Long> oldUnitIds = irrigateGroupSv.getGroupBindUnits(groupId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | IrGroupUnit irGroupUnit = new IrGroupUnit(); | 
|---|
|  |  |  | irGroupUnit.setGroupId(groupId); | 
|---|
|  |  |  | irGroupUnit.setOperator(operator); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | for (int j = 0; j < oldUnitIds.size(); j++) { | 
|---|
|  |  |  | Long oldUnitId = oldUnitIds.get(j); | 
|---|
|  |  |  | IrGroupUnit irGroupUnit1 = new IrGroupUnit(); | 
|---|
|  |  |  | irGroupUnit1.setGroupId(groupId); | 
|---|
|  |  |  | irGroupUnit1.setUnitId(oldUnitId); | 
|---|
|  |  |  | irGroupUnit1.setOperator(operator); | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.deleteGroupUnit(irGroupUnit1)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | if (!newUnitIds.toString().contains(oldUnitId.toString())) { | 
|---|
|  |  |  | irGroupUnit.setUnitId(oldUnitId); | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.deleteGroupUnit(irGroupUnit)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (int i = 0; i < newUnitIds.size(); i++) { | 
|---|
|  |  |  | Long newUnitId = newUnitIds.get(i); | 
|---|
|  |  |  | IrGroupUnit irGroupUnit2 = new IrGroupUnit(); | 
|---|
|  |  |  | irGroupUnit2.setGroupId(groupId); | 
|---|
|  |  |  | irGroupUnit2.setUnitId(newUnitId); | 
|---|
|  |  |  | irGroupUnit2.setOperator(operator); | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(irGroupUnit2)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | Long newUnitId = Long.parseLong(newUnitIds.get(i)); | 
|---|
|  |  |  | if (!oldUnitIds.toString().contains(newUnitId.toString())) { | 
|---|
|  |  |  | irGroupUnit.setUnitId(newUnitId); | 
|---|
|  |  |  | Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(irGroupUnit)).orElse(0); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 轮灌组关联农户 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "add_group_client", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> addGroupClient(@RequestBody @Valid GroupClient po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | IrGroupClient irGroupClient = new IrGroupClient(); | 
|---|
|  |  |  | irGroupClient.setGroupId(po.getGroupId()); | 
|---|
|  |  |  | irGroupClient.setClientId(po.getClientId()); | 
|---|
|  |  |  | irGroupClient.setOperator(po.getOperator()); | 
|---|
|  |  |  | irGroupClient.setOperateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Long rec = Optional.ofNullable(irrigateGroupSv.addGroupClient(irGroupClient)).orElse(0L); | 
|---|
|  |  |  | if (rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(IrrigateResultCode.GRPUP_ASSOCIATE_CLIENT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 新增轮灌组,新代码 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "addIrrigateGroup", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> addIrrigateGroup(@RequestBody @Valid IrrigateGroup po, BindingResult bindingResult) { | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 先判断表内是否存在相同的 groupCode | 
|---|
|  |  |  | if (irrigateGroupSv.existsByGroupCode(po.getGroupCode())) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.GROUP_CODE_ALREADY_EXISTS.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = irrigateGroupSv.addIrrigateGroup(po); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除轮灌组,新代码 | 
|---|
|  |  |  | * @param groupId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping(path = "deleteIrrigateGroup") | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> deleteIrrigateGroup(@RequestParam(required = false) Long groupId) { | 
|---|
|  |  |  | if(groupId == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("轮灌组ID不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = irrigateGroupSv.deleteGroup(groupId); | 
|---|
|  |  |  | 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 = "updateIrrigateGroup", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> updateIrrigateGroup(@RequestBody @Valid IrrigateGroup po, BindingResult bindingResult){ | 
|---|
|  |  |  | if (bindingResult != null && bindingResult.hasErrors()) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(po.getGroupId() == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("轮灌组ID不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 先判断表内是否存在相同的 groupCode(排除当前正在修改的记录) | 
|---|
|  |  |  | if (irrigateGroupSv.existsByGroupCodeExcludeId(po.getGroupCode(), po.getGroupId())) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(IrrigateResultCode.GROUP_CODE_ALREADY_EXISTS.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = irrigateGroupSv.updateIrrigateGroup(po); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取轮灌组列表,新代码 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getSimpleGroups") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getSimpleGroups(QoGroup qo) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | QueryResultVo<List<VoGroupSimple>> res = irrigateGroupSv.getSimpleGroups(qo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取项目记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取全部轮灌组,新代码 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getAllGroups") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<List<VoGroupSimple>> getAllGroups() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(irrigateGroupSv.getAllGroups()); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取项目记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取轮灌组详情,新代码 | 
|---|
|  |  |  | * @param groupId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "getGroupDetail") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<VoGroupDetail> getGroupDetail(@RequestParam Long groupId) { | 
|---|
|  |  |  | if(groupId == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("轮灌组ID不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_result = irrigateGroupSv.getGroupDetail(groupId); | 
|---|
|  |  |  | if(map_result.get("success").equals(false)) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(map_result.get("content")) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|