From f44135f835bf62319f9bb8a32e4592a707e5e8c1 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 27 四月 2025 11:09:55 +0800 Subject: [PATCH] SSO登录逻辑再修改 --- pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java | 75 +++++++++++++++++++++++++++++-------- 1 files changed, 59 insertions(+), 16 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java index 1419aa1..da54d34 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java @@ -172,6 +172,31 @@ } /** + * 鏍规嵁杞亴缁勫悕绉版煡璇㈡槸鍚﹀瓨鍦紙娣诲姞杞亴缁勬椂浣跨敤锛� + * @param groupCode 杞亴缁勫悕绉� + * @return 鏄惁瀛樺湪 + */ + public boolean existsByGroupCode(String groupCode) { + if (groupCode == null || "".equals(groupCode.trim())) { + return false; + } + return irIrrigateGroupMapper.countByGroupCode(groupCode) > 0; + } + + /** + * 鏍规嵁杞亴缁勫悕绉版煡璇㈡槸鍚﹀瓨鍦紙淇敼杞亴缁勬椂浣跨敤锛屾帓闄ゅ綋鍓岻D锛� + * @param groupCode 杞亴缁勫悕绉� + * @param excludeId 闇�瑕佹帓闄ょ殑ID + * @return 鏄惁瀛樺湪 + */ + public boolean existsByGroupCodeExcludeId(String groupCode, Long excludeId) { + if (groupCode == null || "".equals(groupCode.trim())) { + return false; + } + return irIrrigateGroupMapper.countByGroupCodeExcludeId(groupCode, excludeId) > 0; + } + + /** * 鍒犻櫎杞亴缁勪笌鍐滄埛绠$悊 * @param id * @return @@ -260,25 +285,43 @@ * @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); + + // 鍒犻櫎杞亴缁勪笌鍙栨按鍙e叧鑱� Long groupId = po.getGroupId(); - Map map_deleteGroup = deleteGroup(groupId); - if(map_deleteGroup.get("success").equals(false)) { - Map map = new HashMap<>(); - map.put("success", false); - map.put("msg", map_deleteGroup.get("msg").toString()); - map.put("content", null); - return map; - } + irGroupIntakeMapper.deleteByGroupId(groupId); - 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; - } + // 娣诲姞杞亴缁勪笌鍙栨按鍙e叧鑱� + 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", "鍙栨按鍙D鏍煎紡閿欒"); + map.put("content", null); + return map; + } + } Map map = new HashMap<>(); map.put("success", true); map.put("msg", "淇敼杞亴缁勬垚鍔�"); -- Gitblit v1.8.0