pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java
@@ -5,16 +5,13 @@
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.VoGroupOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
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.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
@@ -382,7 +379,7 @@
        }
        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();
@@ -400,7 +397,7 @@
                }
            }
            for (int i = 0; i < newUnitIds.size(); i++) {
                Long newUnitId = newUnitIds.get(i);
                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);
@@ -415,4 +412,34 @@
        }
        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);
    }
}