|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Map updateIrrigateGroup(IrrigateGroup po) { | 
|---|
|  |  |  | // 修改轮灌组 | 
|---|
|  |  |  | IrIrrigateGroup irrigateGroup = new IrIrrigateGroup(); | 
|---|
|  |  |  | irrigateGroup.setId(po.getGroupId()); | 
|---|
|  |  |  | irrigateGroup.setGroupCode(po.getGroupCode()); | 
|---|
|  |  |  | irrigateGroup.setDefaultDuration(po.getDefaultDuration()); | 
|---|
|  |  |  | irrigateGroup.setOperator(po.getOperator()); | 
|---|
|  |  |  | irrigateGroup.setOperateTime(new Date()); | 
|---|
|  |  |  | irrigateGroup.setDeleted((byte) 0); | 
|---|
|  |  |  | irIrrigateGroupMapper.updateByPrimaryKeySelective(irrigateGroup); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 删除轮灌组与取水口关联 | 
|---|
|  |  |  | Long groupId = po.getGroupId(); | 
|---|
|  |  |  | Map map_deleteGroup = deleteGroup(groupId); | 
|---|
|  |  |  | if(map_deleteGroup.get("success").equals(false)) { | 
|---|
|  |  |  | irGroupIntakeMapper.deleteByGroupId(groupId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 添加轮灌组与取水口关联 | 
|---|
|  |  |  | String[] intakeArr = po.getIntakes().split(","); | 
|---|
|  |  |  | Integer sort = 1; | 
|---|
|  |  |  | for(String intekeId : intakeArr) { | 
|---|
|  |  |  | String trimmed = intekeId.trim(); | 
|---|
|  |  |  | if(trimmed.isEmpty()) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Long intakeIdLong = Long.parseLong(trimmed); | 
|---|
|  |  |  | IrGroupIntake irGroupIntake = new IrGroupIntake(); | 
|---|
|  |  |  | irGroupIntake.setGroupId(groupId); | 
|---|
|  |  |  | irGroupIntake.setIntakeId(intakeIdLong); | 
|---|
|  |  |  | irGroupIntakeMapper.insert(irGroupIntake); | 
|---|
|  |  |  | } catch (NumberFormatException  e) { | 
|---|
|  |  |  | Map map = new HashMap<>(); | 
|---|
|  |  |  | map.put("success", false); | 
|---|
|  |  |  | map.put("msg", map_deleteGroup.get("msg").toString()); | 
|---|
|  |  |  | map.put("msg", "取水口ID格式错误"); | 
|---|
|  |  |  | map.put("content", null); | 
|---|
|  |  |  | return map; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_addGroup = addIrrigateGroup(po); | 
|---|
|  |  |  | if(map_addGroup.get("success").equals(false)) { | 
|---|
|  |  |  | Map map = new HashMap<>(); | 
|---|
|  |  |  | map.put("success", false); | 
|---|
|  |  |  | map.put("msg", map_addGroup.get("msg").toString()); | 
|---|
|  |  |  | map.put("content", null); | 
|---|
|  |  |  | return map; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map = new HashMap<>(); | 
|---|
|  |  |  | map.put("success", true); | 
|---|
|  |  |  | map.put("msg", "修改轮灌组成功"); | 
|---|