From 928fe4d9bc4dac80bcdfc87d8006557c865e461d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BC=82=E6=B3=8A?= <1913856125@qq.com> Date: Sat, 7 Feb 2026 14:35:36 +0800 Subject: [PATCH 1/8] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../breed/controller/ScWeanRecordController.java | 11 +---------- .../mapper/produce/breed/ScWeanRecordMapper.xml | 9 +-------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScWeanRecordController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScWeanRecordController.java index 23e0cb7..1db06f5 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScWeanRecordController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScWeanRecordController.java @@ -36,15 +36,6 @@ public class ScWeanRecordController extends BaseController { return getDataTable(list); } - /** - * 【新增】模糊查询耳号列表 (用于前端下拉框远程搜索) - */ - @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:list')") - @GetMapping("/search_ear_numbers") - public AjaxResult searchEarNumbers(@RequestParam("query") String query) { - List list = scWeanRecordService.searchEarNumbers(query); - return success(list); - } /** * 导出断奶记录列表 @@ -135,7 +126,7 @@ public class ScWeanRecordController extends BaseController { */ @PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改 @GetMapping("/search_ear_numbers") - public AjaxResult searchEarNumbers(@RequestParam("query") String query) { + public AjaxResult searchEarNumber(@RequestParam("query") String query) { try { List earNumbers = scWeanRecordService.searchEarNumbers(query); return success(earNumbers); diff --git a/zhyc-module/src/main/resources/mapper/produce/breed/ScWeanRecordMapper.xml b/zhyc-module/src/main/resources/mapper/produce/breed/ScWeanRecordMapper.xml index 7fb8b2b..baae417 100644 --- a/zhyc-module/src/main/resources/mapper/produce/breed/ScWeanRecordMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/breed/ScWeanRecordMapper.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -94,13 +94,6 @@ order by wr.create_time desc - diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml index 7f0c262..c6c2fc0 100644 --- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml @@ -30,10 +30,18 @@ - + + + + + + + + + @@ -42,47 +50,54 @@ select sm.id, - sm.sheep_id, - bs.manage_tags, - ds.id as sheepfold_id, - ds.sheepfold_name, - bsv.id as variety_id, - bsv.variety as variety_name, - '体尺测量' as event_type, - bst.name as sheep_type_name, - sm.measure_date, - bs.gender, - bs.parity, - bs.birth_weight as birth_weight, - bs.weaning_weight as weaning_weight, - sm.current_weight as current_weight, - sm.height, - sm.bust, - sm.body_length, - sm.pipe_length, - sm.chest_depth, - sm.hip_height, - sm.rump_width, - sm.rump_heignt, - sm.hip_width, - sm.hip_cross_height, - bbs.breed as breed_status_name, - bs.lactation_day as lactation_day, - bs.gestation_day as gestation_day, - case when bs.mating_date is not null - then DATEDIFF(NOW(), bs.mating_date) - else null - end as post_mating_day, - sm.comment, - sm.technician, - sm.create_by, - sm.create_time + sm.sheep_id, + sm.user_id, + sm.dept_id, + bs.manage_tags, + ds.id as sheepfold_id, + ds.sheepfold_name, + bsv.id as variety_id, + bsv.variety as variety_name, + '体尺测量' as event_type, + bst.name as sheep_type_name, + sm.measure_date, + bs.gender, + bs.parity, + bs.birth_weight as birth_weight, + bs.weaning_weight as weaning_weight, + sm.current_weight as current_weight, + sm.height, + sm.bust, + sm.body_length, + sm.pipe_length, + sm.chest_depth, + sm.hip_height, + sm.rump_width, + sm.rump_heignt, + sm.hip_width, + sm.hip_cross_height, + sm.month_age, + sm.breast_depth, + sm.breast_position, + sm.breast_length, + sm.breast_adbere, + sm.breast_spacing, + sm.breast_score, + sm.body_score, + sm.lactation_day, + sm.gestation_day, + sm.post_mating_day, + bbs.breed as breed_status_name, + sm.comment, + sm.technician, + sm.create_by, + sm.create_time from sc_body_measure sm - LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id - LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id - LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id - LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id - LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id + LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id + LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id + LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id + LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id + LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id @@ -146,10 +168,23 @@ current_weight, hip_width, hip_cross_height, + month_age, + breast_depth, + breast_position, + breast_length, + breast_adbere, + breast_spacing, + breast_score, + body_score, + lactation_day, + gestation_day, + post_mating_day, comment, technician, create_by, create_time, + user_id, + dept_id, #{sheepId}, @@ -165,10 +200,23 @@ #{currentWeight}, #{hipWidth}, #{hipCrossHeight}, + #{monthAge}, + #{breastDepth}, + #{breastPosition}, + #{breastLength}, + #{breastAdbere}, + #{breastSpacing}, + #{breastScore}, + #{bodyScore}, + #{lactationDay}, + #{gestationDay}, + #{postMatingDay}, #{comment}, #{technician}, #{createBy}, #{createTime}, + #{userId}, + #{deptId}, @@ -188,6 +236,17 @@ current_weight = #{currentWeight}, hip_width = #{hipWidth}, hip_cross_height = #{hipCrossHeight}, + month_age = #{monthAge}, + breast_depth = #{breastDepth}, + breast_position = #{breastPosition}, + breast_length = #{breastLength}, + breast_adbere = #{breastAdbere}, + breast_spacing = #{breastSpacing}, + breast_score = #{breastScore}, + body_score = #{bodyScore}, + lactation_day = #{lactationDay}, + gestation_day = #{gestationDay}, + post_mating_day = #{postMatingDay}, comment = #{comment}, technician = #{technician}, create_by = #{createBy}, @@ -208,11 +267,12 @@ #{id} + diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml index 6dc816f..6500661 100644 --- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml @@ -24,10 +24,12 @@ select sbs.id, sbs.sheep_id, + sbs.user_id, + sbs.dept_id, bs.manage_tags, - bsv.id as varietyId, - bsv.variety as varietyName, - '体况评分' as event_type, + bsv.id as varietyId, + bsv.variety as varietyName, + '体况评分' as event_type, sbs.datetime, sbs.score, ds.sheepfold_name as sheepfoldName, @@ -62,6 +64,10 @@ and bs.is_delete = #{sc.isDelete} + + and sbs.technician like concat('%', #{sc.technician}, '%') + + ${sc.params.dataScope} ORDER BY sbs.create_time DESC @@ -82,6 +88,8 @@ technician, create_by, create_time, + user_id, + dept_id, #{sheepId}, @@ -92,6 +100,8 @@ #{technician}, #{createBy}, #{createTime}, + #{userId}, + #{deptId}, @@ -129,6 +139,5 @@ WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 ORDER BY bs.manage_tags - LIMIT 50 \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml index b674066..44b9222 100644 --- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml @@ -24,11 +24,15 @@ + + select sbr.*, bs.manage_tags as manageTags, + sbr.user_id, + sbr.dept_id, bsv.id as varietyId, bsv.variety as varietyName, '乳房评分' as event_type, @@ -60,6 +64,13 @@ and bs.is_delete = #{sc.isDelete} + + and sbr.technician = #{sc.technician} + + + and sbr.score = #{sc.score} + + ${sc.params.dataScope} ORDER BY sbr.create_time DESC @@ -84,6 +95,8 @@ technician, create_by, create_time, + user_id, + dept_id, #{sheepId}, @@ -98,6 +111,8 @@ #{technician}, #{createBy}, #{createTime}, + #{userId}, + #{deptId}, @@ -137,6 +152,15 @@ FROM bas_sheep bs WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 - ORDER BY bs.manage_tags LIMIT 50 + ORDER BY bs.manage_tags + + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml index 6c0b7b9..514e9a4 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml @@ -25,18 +25,40 @@ + + - - + AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%') @@ -50,6 +72,7 @@ AND sas.type_id = #{typeId} + ${params.dataScope} @@ -61,12 +84,46 @@ INSERT INTO sc_add_sheep - (ear_number, sheepfold, ranch_id, father, mother, born_weight, birthday, - gender, parity, variety_id, type_id, join_date, comment, technician, - create_by, create_time) - VALUES (#{earNumber}, #{sheepfold}, #{ranchId}, #{father}, #{mother}, #{bornWeight}, - #{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate}, - #{comment}, #{technician}, #{createBy}, #{createTime}) + + ear_number, + sheepfold, + ranch_id, + father, + mother, + born_weight, + birthday, + gender, + parity, + variety_id, + type_id, + join_date, + comment, + technician, + create_by, + create_time, + user_id, + dept_id, + + + #{earNumber}, + #{sheepfold}, + #{ranchId}, + #{father}, + #{mother}, + #{bornWeight}, + #{birthday}, + #{gender}, + #{parity}, + #{varietyId}, + #{typeId}, + #{joinDate}, + #{comment}, + #{technician}, + #{createBy}, + #{createTime}, + #{userId}, + #{deptId}, + diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml index e2695b3..a574a3e 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml @@ -21,6 +21,8 @@ select scc.id, scc.sheep_id, + scc.user_id, + scc.dept_id, bs.manage_tags as manage_tags, sf.sheepfold_name as sheepfold_name, '改备注' as event_type, @@ -43,9 +45,9 @@ bs.manage_tags like concat('%', #{tag}, '%') - - - + + + and scc.technician like concat('%', #{sc.technician}, '%') @@ -66,6 +68,7 @@ and bs.is_delete = #{sc.isDelete} + ${sc.params.dataScope} ORDER BY scc.create_time DESC @@ -85,6 +88,8 @@ create_time, event_date, technician, + user_id, + dept_id, #{sheepId}, @@ -94,6 +99,8 @@ #{createTime}, #{eventDate}, #{technician}, + #{userId}, + #{deptId}, @@ -128,6 +135,5 @@ WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 ORDER BY bs.manage_tags - LIMIT 50 \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml index 39b26ef..f33c1f7 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml @@ -73,6 +73,7 @@ and bs.is_delete = 1 + ${sc.params.dataScope} ORDER BY sce.create_time DESC @@ -94,6 +95,8 @@ create_time, event_date, technician, + user_id, + dept_id, #{sheepId}, @@ -105,6 +108,8 @@ #{createTime}, #{eventDate}, #{technician}, + #{userId}, + #{deptId}, @@ -141,6 +146,5 @@ WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 ORDER BY bs.manage_tags - LIMIT 50 \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml index 9119ca8..c3b9bf4 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml @@ -65,6 +65,7 @@ and bs.is_delete = #{sc.isDelete} + ${sc.params.dataScope} ORDER BY scv.create_time DESC @@ -83,8 +84,10 @@ comment, create_by, create_time, - technician, - event_date, + technician, + event_date, + user_id, + dept_id, #{sheepId}, @@ -93,8 +96,10 @@ #{comment}, #{createBy}, #{createTime}, - #{technician}, - #{eventDate}, + #{technician}, + #{eventDate}, + #{userId}, + #{deptId}, @@ -129,6 +134,6 @@ FROM bas_sheep bs WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 - ORDER BY bs.manage_tags LIMIT 50 + ORDER BY bs.manage_tags \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml index b74eb91..03cbb40 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml @@ -18,11 +18,15 @@ + + SELECT tg.id, tg.sheep_id, + tg.user_id, + tg.dept_id, s.manage_tags AS manageTags, tg.event_type AS eventType, tg.trans_date AS transDate, @@ -38,9 +42,7 @@ tg.create_time, sf_from.sheepfold_name AS foldFromName, sf_to.sheepfold_name AS foldToName, - tg.technician, - st.id AS sheepTypeId, - st.name AS sheepTypeName + tg.technician FROM sc_trans_group tg LEFT JOIN bas_sheep s ON tg.sheep_id = s.id LEFT JOIN bas_sheep_type st ON s.type_id = st.id @@ -74,6 +76,7 @@ and s.is_delete = #{sc.isDelete} + ${sc.params.dataScope} ORDER BY tg.create_time DESC @@ -99,6 +102,8 @@ comment, create_by, create_time, + user_id, + dept_id, #{sheepId}, @@ -112,6 +117,8 @@ #{comment}, #{createBy}, #{createTime}, + #{userId}, + #{deptId}, diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml index 79073ae..4b5fcfa 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml @@ -19,12 +19,16 @@ + + SELECT t.*, bv.variety AS varietyName, bs.manage_tags AS manageTags, + t.user_id, + t.dept_id, sf.sheepfold_name AS sheepfoldName, t.event_type AS eventType, t.transition_date AS transitionDate, @@ -77,6 +81,7 @@ and bs.ranch_id = #{sc.currentRanchId} + ${sc.params.dataScope} ORDER BY t.create_time DESC @@ -101,6 +106,8 @@ comment, create_by, create_time, + user_id, + dept_id, #{sheepId}, @@ -115,6 +122,8 @@ #{comment}, #{createBy}, #{createTime}, + #{userId}, + #{deptId}, @@ -171,6 +180,6 @@ FROM bas_sheep bs WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 - ORDER BY bs.manage_tags LIMIT 50 + ORDER BY bs.manage_tags \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml index 92dfb96..66d31e2 100644 --- a/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml @@ -50,7 +50,9 @@ and bs.sheepfold_id = #{sc.sheepfold} and bs.variety_id = #{sc.varietyId} - and sc.technician like concat('%', #{sc.technician}, '%') + + and sc.technician like concat('%', #{sc.technician}, '%') + and sc.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime} @@ -60,6 +62,7 @@ and bs.is_delete = #{sc.isDelete} + ${sc.params.dataScope} ORDER BY sc.create_time DESC @@ -80,6 +83,8 @@ create_by, create_time, event_date, + user_id, + dept_id, #{sheepId}, @@ -90,6 +95,8 @@ #{createBy}, #{createTime}, #{eventDate}, + #{userId}, + #{deptId}, @@ -126,6 +133,5 @@ WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') AND bs.is_delete = 0 ORDER BY bs.manage_tags - LIMIT 50 \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml index cb31739..6622a68 100644 --- a/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml @@ -59,6 +59,7 @@ and bs.is_delete = #{sc.isDelete} + ${sc.params.dataScope} ORDER BY fh.create_time DESC @@ -68,26 +69,32 @@ where fh.id = #{id} - - INSERT INTO sc_fix_hoof - (sheep_id, - sheepfold, - variety_id, - comment, - technician, - event_date, - create_by, - create_time) - VALUES - (#{sheepId}, - #{sheepfold}, - #{varietyId}, - #{comment}, - #{technician}, - #{eventDate}, - #{createBy}, - #{createTime}) + + insert into sc_fix_hoof + + sheep_id, + sheepfold, + variety_id, + comment, + technician, + event_date, + create_by, + create_time, + user_id, + dept_id, + + + #{sheepId}, + #{sheepfold}, + #{varietyId}, + #{comment}, + #{technician}, + #{eventDate}, + #{createBy}, + #{createTime}, + #{userId}, + #{deptId}, + From 5cf769c9f5ab6d57e64bade8fda5886a83456aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BC=82=E6=B3=8A?= <1913856125@qq.com> Date: Mon, 9 Feb 2026 20:24:51 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E7=94=9F=E7=89=A9=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=9C=A8=E7=BE=A4=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?execl=E5=AF=BC=E5=87=BA=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhyc/module/biosafety/domain/Deworm.java | 21 ++++- .../module/biosafety/domain/Diagnosis.java | 21 +++++ .../zhyc/module/biosafety/domain/Health.java | 7 +- .../module/biosafety/domain/Immunity.java | 7 +- .../biosafety/domain/QuarantineReport.java | 38 +++++++++ .../biosafety/domain/SwMedicineUsage.java | 19 ++++- .../module/biosafety/domain/Treatment.java | 35 +++++++- .../biosafety/enums/DiagnosisResult.java | 74 +++++++++++++++++ .../biosafety/enums/PrescriptionType.java | 75 ++++++++++++++++++ .../biosafety/enums/QuarantineResult.java | 71 +++++++++++++++++ .../biosafety/enums/QuarantineStatus.java | 72 +++++++++++++++++ .../biosafety/enums/TreatmentStatus.java | 31 ++++++++ .../common/controller/UserPostController.java | 9 ++- .../zhyc/module/common/mapper/PostMapper.java | 21 ++++- .../module/common/service/PostService.java | 2 +- .../common/service/impl/PostServiceImpl.java | 4 +- .../java/com/zhyc/module/enums/UseType.java | 4 - .../work/controller/WorkOrderController.java | 2 + .../zhyc/module/work/domain/WorkOrder.java | 9 ++- .../com/zhyc/module/work/enums/BizType.java | 79 +++++++++++++++++++ .../zhyc/module/work/enums/TaskPriority.java | 73 +++++++++++++++++ .../zhyc/module/work/enums/TaskStatus.java | 76 ++++++++++++++++++ .../service/impl/WorkOrderServiceImpl.java | 3 + .../mapper/biosafety/DewormMapper.xml | 1 + .../mapper/biosafety/DiagnosisMapper.xml | 1 + .../mapper/biosafety/HealthMapper.xml | 1 + .../mapper/biosafety/ImmunityMapper.xml | 1 + .../biosafety/QuarantineReportMapper.xml | 1 + .../mapper/biosafety/TreatmentMapper.xml | 1 + .../resources/mapper/work/WorkOrderMapper.xml | 7 +- 30 files changed, 743 insertions(+), 23 deletions(-) create mode 100644 zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/DiagnosisResult.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/PrescriptionType.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineResult.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineStatus.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/TreatmentStatus.java delete mode 100644 zhyc-module/src/main/java/com/zhyc/module/enums/UseType.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/work/enums/BizType.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskPriority.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskStatus.java diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java index 7db3a19..235fbac 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java @@ -58,7 +58,7 @@ public class Deworm extends BaseEntity private Long deptId; /** 药品使用记录 */ - @Excel(name = "药品使用记录") +// @Excel(name = "药品使用记录") private Integer usageId; @@ -78,9 +78,28 @@ public class Deworm extends BaseEntity @Excel(name = "备注") private String comment; + /** + * 是否在群查询条件(0-在群,1-离群),非数据库字段 + */ + private Integer isDelete; // 排序查询 private String orderByColumn; private String isAsc; + public void setGender(String gender) { + this.gender = gender; + if (gender != null && !gender.trim().isEmpty()) { + try { + Integer genderCode = Integer.valueOf(gender.trim()); + this.genderName = Gender.getDescByCode(genderCode); + } catch (NumberFormatException e) { + // 如果转换失败,设置为空或默认值 + this.genderName = null; + } + } else { + this.genderName = null; + } + } + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java index 14cb984..cffaa39 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java @@ -80,6 +80,8 @@ public class Diagnosis extends BaseEntity /** 诊疗结果 */ @Excel(name = "诊疗结果") + private String resultName; + /** 诊断结果 */ private String result; /** 开始时间 */ @@ -106,6 +108,11 @@ public class Diagnosis extends BaseEntity private String orderByColumn; private String isAsc; + /** + * 是否在群查询条件(0-在群,1-离群),非数据库字段 + */ + private Integer isDelete; + private Long userId; private Long deptId; @@ -123,5 +130,19 @@ public class Diagnosis extends BaseEntity this.genderName = null; } } + public void setResult(String result) { + this.result = result; + if (result != null && !result.trim().isEmpty()) { + try { + Integer resultCode = Integer.valueOf(result.trim()); + this.resultName = Gender.getDescByCode(resultCode); + } catch (NumberFormatException e) { + // 如果转换失败,设置为空或默认值 + this.resultName = null; + } + } else { + this.resultName = null; + } + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java index 9eadf30..320c014 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java @@ -29,7 +29,7 @@ public class Health extends BaseEntity private Date datetime; /** 羊只id */ - @Excel(name = "羊只id") +// @Excel(name = "羊只id") private Long sheepId; private Integer[] sheepIds; @@ -79,6 +79,11 @@ public class Health extends BaseEntity private String orderByColumn; private String isAsc; + /** + * 是否在群查询条件(0-在群,1-离群),非数据库字段 + */ + private Integer isDelete; + public void setGender(String gender) { this.gender = gender; if (gender != null && !gender.trim().isEmpty()) { diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java index 70ccaa0..9b399ee 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java @@ -28,7 +28,6 @@ public class Immunity extends BaseEntity private Long id; /** 羊只id */ - @Excel(name = "羊只id") private Long sheepId; private Integer[] sheepIds; @@ -42,7 +41,6 @@ public class Immunity extends BaseEntity @Excel(name = "品种") - private String variety; @Excel(name = "羊只类别") private String sheepType; @@ -81,6 +79,11 @@ public class Immunity extends BaseEntity private Long userId; private Long deptId; + /** + * 是否在群查询条件(0-在群,1-离群),非数据库字段 + */ + private Integer isDelete; + // 药品使用 private List usageDetails; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java index 5b2a5f4..bb74310 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java @@ -4,6 +4,8 @@ import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; +import com.zhyc.module.biosafety.enums.QuarantineResult; +import com.zhyc.module.biosafety.enums.QuarantineStatus; import com.zhyc.module.enums.Gender; import lombok.AllArgsConstructor; import lombok.Data; @@ -91,10 +93,12 @@ public class QuarantineReport extends BaseEntity /** 检疫结果 */ @Excel(name = "检疫结果") + private String resultName; private String result; /** 状态 */ @Excel(name = "状态") + private String statusName; private Integer status; /** 备注*/ @@ -104,6 +108,11 @@ public class QuarantineReport extends BaseEntity private Long userId; private Long deptId; + /** + * 是否在群查询条件(0-在群,1-离群),非数据库字段 + */ + private Integer isDelete; + public void setGender(String gender) { this.gender = gender; if (gender != null && !gender.trim().isEmpty()) { @@ -118,6 +127,35 @@ public class QuarantineReport extends BaseEntity this.genderName = null; } } +// 检疫结果转换 + public void setResult(String result) { + this.result = result; + if (result != null && !result.trim().isEmpty()) { + try { + Integer resultCode = Integer.valueOf(result.trim()); + this.resultName = QuarantineResult.getDescByCode(resultCode); + } catch (NumberFormatException e) { + // 如果转换失败,设置为空或默认值 + this.resultName = null; + } + } else { + this.genderName = null; + } + } +// 检疫状态 + public void setStatus(Integer status) { + this.status = status; + if (status != null) { + try { + this.statusName = QuarantineStatus.getDescByCode(status); + } catch (NumberFormatException e) { + // 如果转换失败,设置为空或默认值 + this.statusName = null; + } + } else { + this.statusName = null; + } + } // 排序查询 private String orderByColumn; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java index 62e212f..8210e74 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java @@ -5,6 +5,8 @@ import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; +import com.zhyc.module.biosafety.enums.PrescriptionType; +import com.zhyc.module.biosafety.enums.TreatmentStatus; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -32,7 +34,7 @@ public class SwMedicineUsage extends BaseEntity private String name; /** 羊舍名称 */ - @Excel(name = "使用名称" ,width = 20, needMerge = true) + @Excel(name = "羊舍名称" ,width = 20, needMerge = true) private String sheepfoldName; private Integer sheepfoldId; /** 耳号 */ @@ -51,8 +53,10 @@ public class SwMedicineUsage extends BaseEntity /** 使用类型 */ @Excel(name = "使用类型",width = 20, needMerge = true) + private String useTypeName; private String useType; + private Long userId; private Long deptId; @@ -61,4 +65,17 @@ public class SwMedicineUsage extends BaseEntity private List swMedicineUsageDetailsList; + /** 状态转换 */ + public void setUseType(String useType) { + this.useType = useType; + this.useTypeName = null; + if (useType != null && !useType.trim().isEmpty()) { + try { + this.useTypeName = PrescriptionType.getDescByCode(Integer.valueOf(useType.trim())); + } catch (NumberFormatException ex) { + // 可选:记录日志、或抛业务异常 + this.useTypeName = "未知"; + } + } + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java index f6dce30..174889f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; +import com.zhyc.module.biosafety.enums.TreatmentStatus; import com.zhyc.module.enums.Gender; import lombok.AllArgsConstructor; import lombok.Data; @@ -97,22 +98,38 @@ public class Treatment extends BaseEntity private String veterinary; /** 治疗状态 */ @Excel(name = "治疗状态") + private String statusName; private String status; /** 药品使用记录id */ - @Excel(name = "药品使用记录id") + private Integer usageId; private Long userId; private Long deptId; + /** + * 是否在群查询条件(0-在群,1-离群),非数据库字段 + */ + private Integer isDelete; + + + + // 药品使用 private List usageDetails; /** 备注 */ @Excel(name = "备注") private String comment; + + + // 排序查询 + private String orderByColumn; + private String isAsc; + + /** 性别转换 */ public void setGender(String gender) { this.gender = gender; // 保留原始字符串 this.genderName = null; // 先清空 @@ -125,8 +142,18 @@ public class Treatment extends BaseEntity } } } + /** 状态转换 */ + public void setStatus(String status) { + this.status = status; + this.statusName = null; + if (status != null && !status.trim().isEmpty()) { + try { + this.statusName = TreatmentStatus.getDescByCode(Integer.valueOf(status.trim())); + } catch (NumberFormatException ex) { + // 可选:记录日志、或抛业务异常 + this.statusName = "未知"; + } + } + } - // 排序查询 - private String orderByColumn; - private String isAsc; } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/DiagnosisResult.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/DiagnosisResult.java new file mode 100644 index 0000000..c4a11f0 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/DiagnosisResult.java @@ -0,0 +1,74 @@ +package com.zhyc.module.biosafety.enums; + + +/** + * 诊疗结果枚举 + */ +public enum DiagnosisResult { + + ABANDONED(0, "放弃"), + CURED(1, "已治愈"), + IN_TREATMENT(2, "治疗中"), + COMPLETED(3, "治疗完成"); + + private final int code; + private final String desc; + + DiagnosisResult(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (DiagnosisResult result : values()) { + if (result.code == code) { + return result.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static DiagnosisResult getByCode(Integer code) { + if (code == null) { + return null; + } + for (DiagnosisResult result : values()) { + if (result.code == code) { + return result; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (DiagnosisResult result : values()) { + if (result.desc.equals(desc)) { + return result.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/PrescriptionType.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/PrescriptionType.java new file mode 100644 index 0000000..dee6b45 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/PrescriptionType.java @@ -0,0 +1,75 @@ +package com.zhyc.module.biosafety.enums; + + +/** + * 处方类型枚举 + */ +public enum PrescriptionType { + + IMMUNITY(0, "免疫"), + DEWORMING(1, "驱虫"), + HEALTH_CARE(2, "保健"), + DISINFECTION(3, "消毒"), + DISEASE_TREATMENT(4, "疾病治疗"); + + private final int code; + private final String desc; + + PrescriptionType(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (PrescriptionType type : values()) { + if (type.code == code) { + return type.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static PrescriptionType getByCode(Integer code) { + if (code == null) { + return null; + } + for (PrescriptionType type : values()) { + if (type.code == code) { + return type; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (PrescriptionType type : values()) { + if (type.desc.equals(desc)) { + return type.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineResult.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineResult.java new file mode 100644 index 0000000..ead345b --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineResult.java @@ -0,0 +1,71 @@ +package com.zhyc.module.biosafety.enums; + +/** + * 检疫结果枚举 + */ +public enum QuarantineResult { + + NEGATIVE(0, "阴性"), + POSITIVE(1, "阳性"); + + private final int code; + private final String desc; + + QuarantineResult(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (QuarantineResult result : values()) { + if (result.code == code) { + return result.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static QuarantineResult getByCode(Integer code) { + if (code == null) { + return null; + } + for (QuarantineResult result : values()) { + if (result.code == code) { + return result; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (QuarantineResult result : values()) { + if (result.desc.equals(desc)) { + return result.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineStatus.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineStatus.java new file mode 100644 index 0000000..632ff46 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/QuarantineStatus.java @@ -0,0 +1,72 @@ +package com.zhyc.module.biosafety.enums; + + +/** + * 检疫状态枚举 + */ +public enum QuarantineStatus { + + PENDING(0, "送检中"), + TESTED(1, "已检测"); + + private final int code; + private final String desc; + + QuarantineStatus(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (QuarantineStatus status : values()) { + if (status.code == code) { + return status.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static QuarantineStatus getByCode(Integer code) { + if (code == null) { + return null; + } + for (QuarantineStatus status : values()) { + if (status.code == code) { + return status; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (QuarantineStatus status : values()) { + if (status.desc.equals(desc)) { + return status.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/TreatmentStatus.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/TreatmentStatus.java new file mode 100644 index 0000000..88351b8 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/enums/TreatmentStatus.java @@ -0,0 +1,31 @@ +package com.zhyc.module.biosafety.enums; + +/** + * 治疗状态枚举 + */ +public enum TreatmentStatus { + + ABANDONED(-1, "放弃", 0), + IN_TREATMENT(0, "治疗中", 1), + TREATMENT_COMPLETED(1, "治疗完成", 2), + CURED(2, "已治愈", 3); + + private final int code; + private final String desc; + private final int sort; + + TreatmentStatus(int code, String desc, int sort) { + this.code = code; + this.desc = desc; + this.sort = sort; + } + + public static String getDescByCode(Integer code) { + for (TreatmentStatus status : values()) { + if (status.code == code) { + return status.desc; + } + } + return "未知"; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/common/controller/UserPostController.java b/zhyc-module/src/main/java/com/zhyc/module/common/controller/UserPostController.java index 7b63e2e..9e30cc4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/common/controller/UserPostController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/common/controller/UserPostController.java @@ -35,7 +35,14 @@ public class UserPostController { // 获取岗位(部门) @GetMapping("/getPost") public AjaxResult getPost(String postName){ - List list = postService.selectPostList(); + List list = postService.selectPostList(postName); + return AjaxResult.success(list); + } + +// 获取岗位班组 + @GetMapping("/getPostTeam") + public AjaxResult getPostTeam(){ + List list = postService.selectPostList("班"); return AjaxResult.success(list); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/common/mapper/PostMapper.java b/zhyc-module/src/main/java/com/zhyc/module/common/mapper/PostMapper.java index e2bc5d2..643a587 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/common/mapper/PostMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/common/mapper/PostMapper.java @@ -1,12 +1,29 @@ package com.zhyc.module.common.mapper; import com.zhyc.module.common.domain.Post; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import java.util.List; public interface PostMapper { - @Select("select * from sys_post where status = '0'") - List selectPostList(); + /** + * 根据岗位名称模糊查询岗位列表 + * + * @param postName 岗位名称(可为空) + * @return 岗位列表 + */ + @Select("SELECT post_id, post_code, post_name, post_sort, status FROM sys_post WHERE post_name LIKE CONCAT('%', #{postName}, '%') AND status = '0'") + @Results({ + @Result(property = "postId", column = "post_id"), + @Result(property = "postCode", column = "post_code"), + @Result(property = "postName", column = "post_name"), + @Result(property = "postSort", column = "post_sort"), + @Result(property = "status", column = "status") + }) + List selectPostList(@Param("postName") String postName); } + diff --git a/zhyc-module/src/main/java/com/zhyc/module/common/service/PostService.java b/zhyc-module/src/main/java/com/zhyc/module/common/service/PostService.java index c7a2edf..9607a24 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/common/service/PostService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/common/service/PostService.java @@ -5,5 +5,5 @@ import com.zhyc.module.common.domain.Post; import java.util.List; public interface PostService { - List selectPostList(); + List selectPostList(String postName); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/common/service/impl/PostServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/common/service/impl/PostServiceImpl.java index 3ab72f0..9c148f6 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/common/service/impl/PostServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/common/service/impl/PostServiceImpl.java @@ -15,8 +15,8 @@ public class PostServiceImpl implements PostService { PostMapper postMapper; @Override - public List selectPostList() { - List list = postMapper.selectPostList(); + public List selectPostList(String postName) { + List list = postMapper.selectPostList(postName); return list; } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/enums/UseType.java b/zhyc-module/src/main/java/com/zhyc/module/enums/UseType.java deleted file mode 100644 index bfce1ec..0000000 --- a/zhyc-module/src/main/java/com/zhyc/module/enums/UseType.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.zhyc.module.enums; - -public enum UseType { -} diff --git a/zhyc-module/src/main/java/com/zhyc/module/work/controller/WorkOrderController.java b/zhyc-module/src/main/java/com/zhyc/module/work/controller/WorkOrderController.java index 37ecfab..a067c70 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/work/controller/WorkOrderController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/work/controller/WorkOrderController.java @@ -79,6 +79,8 @@ public class WorkOrderController extends BaseController @PostMapping public AjaxResult add(@RequestBody WorkOrder workOrder) { + workOrder.setDeptId(getDeptId()); //修改成你对应的实体类 + workOrder.setUserId(getUserId()); return toAjax(workOrderService.insertWorkOrder(workOrder)); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/work/domain/WorkOrder.java b/zhyc-module/src/main/java/com/zhyc/module/work/domain/WorkOrder.java index 1f3948c..922d0bf 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/work/domain/WorkOrder.java +++ b/zhyc-module/src/main/java/com/zhyc/module/work/domain/WorkOrder.java @@ -40,7 +40,8 @@ public class WorkOrder extends BaseEntity private Long planId; /** 业务类型:1免疫 2保健 3转群 4称重 5配种 6干奶 7淘汰 8消毒 9饲喂,必填 */ - @Excel(name = "业务类型:1免疫 2保健 3转群 4称重 5配种 6干奶 7淘汰 8消毒 9饲喂,必填") +// @Excel(name = "业务类型:1免疫 2保健 3转群 4称重 5配种 6干奶 7淘汰 8消毒 9饲喂,必填") + @Excel(name = "业务类型", readConverterExp = "1=免疫,2=保健,3=转群,4=称重,5=配种,6=干奶,7=淘汰,8=消毒,9=饲喂") private Integer bizType; private String bizTypes; private Integer [] bizTypeArray; @@ -100,13 +101,13 @@ public class WorkOrder extends BaseEntity private String toolList; /** 状态:0待派工 1已派工 2执行中 3已完成 4已取消 5异常,必填 */ - @Excel(name = "状态:0待派工 1已派工 2执行中 3已完成 4已取消 5异常,必填") + @Excel(name = "状态", readConverterExp = "0=待派工,1=已派工,2=执行中,3=已完成,4=已取消,5=异常") private Integer status; private String statuss; private Integer [] statusArray; /** 优先级:1普通 2重要 3紧急,必填 */ - @Excel(name = "优先级:1普通 2重要 3紧急,必填") + @Excel(name = "优先级", readConverterExp = "1=普通,2=重要,3=紧急") private Integer priority; private String prioritys; private Integer [] priorityArray; @@ -147,4 +148,6 @@ public class WorkOrder extends BaseEntity /** 逻辑删除:0正常 1已删除,必填 */ private Integer deleted; + private Long deptId; + private Long userId; } diff --git a/zhyc-module/src/main/java/com/zhyc/module/work/enums/BizType.java b/zhyc-module/src/main/java/com/zhyc/module/work/enums/BizType.java new file mode 100644 index 0000000..cf1fef2 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/work/enums/BizType.java @@ -0,0 +1,79 @@ +package com.zhyc.module.work.enums; + + +/** + * 业务类型枚举 + */ +public enum BizType { + + IMMUNITY(1, "免疫"), + HEALTH_CARE(2, "保健"), + TRANSFER_GROUP(3, "转群"), + WEIGHING(4, "称重"), + BREEDING(5, "配种"), + DRY_MILK(6, "干奶"), + ELIMINATION(7, "淘汰"), + DISINFECTION(8, "消毒"), + FEEDING(9, "饲喂"); + + private final int code; + private final String desc; + + BizType(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (BizType type : values()) { + if (type.code == code) { + return type.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static BizType getByCode(Integer code) { + if (code == null) { + return null; + } + for (BizType type : values()) { + if (type.code == code) { + return type; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (BizType type : values()) { + if (type.desc.equals(desc)) { + return type.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskPriority.java b/zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskPriority.java new file mode 100644 index 0000000..4c44af3 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskPriority.java @@ -0,0 +1,73 @@ +package com.zhyc.module.work.enums; + + +/** + * 任务优先级枚举 + */ +public enum TaskPriority { + + NORMAL(1, "普通"), + IMPORTANT(2, "重要"), + URGENT(3, "紧急"); + + private final int code; + private final String desc; + + TaskPriority(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (TaskPriority priority : values()) { + if (priority.code == code) { + return priority.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static TaskPriority getByCode(Integer code) { + if (code == null) { + return null; + } + for (TaskPriority priority : values()) { + if (priority.code == code) { + return priority; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (TaskPriority priority : values()) { + if (priority.desc.equals(desc)) { + return priority.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskStatus.java b/zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskStatus.java new file mode 100644 index 0000000..8100733 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/work/enums/TaskStatus.java @@ -0,0 +1,76 @@ +package com.zhyc.module.work.enums; + + +/** + * 任务状态枚举 + */ +public enum TaskStatus { + + PENDING(0, "待派工"), + ASSIGNED(1, "已派工"), + IN_PROGRESS(2, "执行中"), + COMPLETED(3, "已完成"), + CANCELLED(4, "已取消"), + EXCEPTION(5, "异常"); + + private final int code; + private final String desc; + + TaskStatus(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + /** + * 根据code获取描述 + */ + public static String getDescByCode(Integer code) { + if (code == null) { + return ""; + } + for (TaskStatus status : values()) { + if (status.code == code) { + return status.desc; + } + } + return ""; + } + + /** + * 根据code获取枚举 + */ + public static TaskStatus getByCode(Integer code) { + if (code == null) { + return null; + } + for (TaskStatus status : values()) { + if (status.code == code) { + return status; + } + } + return null; + } + + /** + * 根据描述获取code + */ + public static Integer getCodeByDesc(String desc) { + if (desc == null || desc.trim().isEmpty()) { + return null; + } + for (TaskStatus status : values()) { + if (status.desc.equals(desc)) { + return status.code; + } + } + return null; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/work/service/impl/WorkOrderServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/work/service/impl/WorkOrderServiceImpl.java index 92303a0..3644d28 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/work/service/impl/WorkOrderServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/work/service/impl/WorkOrderServiceImpl.java @@ -1,6 +1,8 @@ package com.zhyc.module.work.service.impl; import java.util.List; + +import com.zhyc.common.annotation.DataScope; import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -40,6 +42,7 @@ public class WorkOrderServiceImpl implements IWorkOrderService * @return 派工单 */ @Override + @DataScope(deptAlias = "w" , userAlias = "w") public List selectWorkOrderList(WorkOrder workOrder) { String username = SecurityUtils.getLoginUser().getUser().getNickName(); diff --git a/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml index f555fb5..e4b3b5d 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml @@ -58,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and datetime between #{params.beginDatetime} and #{params.endDatetime} and technical = #{technical} + and bs.is_delete = #{isDelete} ${params.dataScope} diff --git a/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml index 242edfa..ef14557 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml @@ -69,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and result = #{result} and treat_day = #{treatDay} and sd.sheepfold_id = #{sheepfoldId} + and sf.is_delete = #{isDelete} ${params.dataScope} ORDER BY datetime DESC diff --git a/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml index d2faf3d..cf0e788 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml @@ -62,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and datetime between #{params.beginDatetime} and #{params.endDatetime} and technical = #{technical} + and bs.is_delete = #{isDelete} ${params.dataScope} diff --git a/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml index c06c8c6..118f84a 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml @@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and datetime between #{params.beginDatetime} and #{params.endDatetime} and technical = #{technical} + and bs.is_delete = #{isDelete} ${params.dataScope} diff --git a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml index b678dbf..8dbd878 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml @@ -72,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and result = #{result} and status = #{status} and sqr.sheep_type=#{sheepType} + and sf.is_delete = #{isDelete} ${params.dataScope} ORDER BY datetime DESC diff --git a/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml index 9164a74..1628620 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml @@ -78,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and disease_id = #{diseaseId} and status = #{status} and veterinary = #{veterinary} + and bs.is_delete = #{isDelete} ${params.dataScope} ORDER BY datetime DESC diff --git a/zhyc-module/src/main/resources/mapper/work/WorkOrderMapper.xml b/zhyc-module/src/main/resources/mapper/work/WorkOrderMapper.xml index d38b162..8ac34d7 100644 --- a/zhyc-module/src/main/resources/mapper/work/WorkOrderMapper.xml +++ b/zhyc-module/src/main/resources/mapper/work/WorkOrderMapper.xml @@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, order_no, plan_id, biz_type, title, content, department, executor_ids,executor, execute_date, execute_time, sheep_scope, location, material_list, tool_list, status, priority, issuer_id, issuer,issue_time, receiver_id, receiver,receive_time, finish_time, result, remark, create_time, update_time, deleted from work_order + select id, order_no, plan_id, biz_type, title, content, department, executor_ids,executor, execute_date, execute_time, sheep_scope, location, material_list, tool_list, status, priority, issuer_id, issuer,issue_time, receiver_id, receiver,receive_time, finish_time, result, remark, create_time, update_time, deleted from work_order w @@ -140,6 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_time, deleted, + dept_id, + user_id, #{orderNo}, @@ -170,6 +173,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateTime}, #{deleted}, + #{deptId}, + #{userId}, From d9a621d6a74e483f2ab2dc3d624e484aa02a6057 Mon Sep 17 00:00:00 2001 From: zyh <2066096076@qq.com> Date: Mon, 9 Feb 2026 21:46:12 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E8=BD=AC=E5=9C=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=86=E7=A6=BBbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScTransitionInfoController.java | 23 ++++-- .../mapper/ScTransitionInfoMapper.java | 2 +- .../service/IScTransitionInfoService.java | 2 +- .../impl/ScTransitionInfoServiceImpl.java | 58 +++++++++----- .../manage_sheep/ScTransitionInfoMapper.xml | 79 ++++++++++--------- 5 files changed, 95 insertions(+), 69 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java index fe5e615..43f1dd4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java @@ -68,20 +68,27 @@ public class ScTransitionInfoController extends BaseController { /** * 新增转场 */ +// @PreAuthorize("@ss.hasPermi('produce:transition_info:add')") +// @Log(title = "转场", businessType = BusinessType.INSERT) +// @PostMapping +// public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) { +// scTransitionInfo.setUserId(getUserId()); +// scTransitionInfo.setDeptId(getDeptId()); +// return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo)); +// } + + //批量添加转场 @PreAuthorize("@ss.hasPermi('produce:transition_info:add')") @Log(title = "转场", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) { - scTransitionInfo.setUserId(getUserId()); - scTransitionInfo.setDeptId(getDeptId()); - return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo)); - } - - //批量添加 @PostMapping("/batch") public AjaxResult addBatch(@RequestBody List transitionInfoList) { Long userId = getUserId(); Long deptId = getDeptId(); + + for (ScTransitionInfo info : transitionInfoList) { + info.setUserId(userId); + info.setDeptId(deptId); + } return toAjax(scTransitionInfoService.insertScTransitionInfoBatch(transitionInfoList)); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java index af07511..45b5b61 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java @@ -35,7 +35,7 @@ public interface ScTransitionInfoMapper * @param scTransitionInfo 转场 * @return 结果 */ - public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo); +// public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo); /** * 修改转场 diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java index d4c85ea..f986ba5 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java @@ -33,7 +33,7 @@ public interface IScTransitionInfoService { * @param scTransitionInfo 转场 * @return 结果 */ - public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo); + // public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo); /** * 修改转场 diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java index 73067fe..4c73612 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java @@ -67,26 +67,35 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService * @param scTransitionInfo 转场 * @return 结果 */ - @Override - @Transactional(rollbackFor = Exception.class) - public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo) { - // 根据耳号查询羊只信息 - String manageTags = scTransitionInfo.getManageTags(); - if (StringUtils.isNotBlank(manageTags)) { - BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim()); - if (sheep == null) { - throw new RuntimeException("耳号不存在,请检查输入"); - } - scTransitionInfo.setSheepId(sheep.getId().intValue()); - scTransitionInfo.setVarietyId(sheep.getVarietyId()); - } else { - throw new RuntimeException("耳号不能为空"); - } - - scTransitionInfo.setStatus(0); - scTransitionInfo.setCreateTime(DateUtils.getNowDate()); - return scTransitionInfoMapper.insertScTransitionInfo(scTransitionInfo); - } +// @Override +// @Transactional(rollbackFor = Exception.class) +// public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo) { +// // 根据耳号查询羊只信息 +// String manageTags = scTransitionInfo.getManageTags(); +// if (StringUtils.isNotBlank(manageTags)) { +// BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim()); +// if (sheep == null) { +// throw new RuntimeException("耳号不存在,请检查输入"); +// } +// scTransitionInfo.setSheepId(sheep.getId().intValue()); +// scTransitionInfo.setVarietyId(sheep.getVarietyId()); +// if (scTransitionInfo.getSheepfoldId() == null && sheep.getSheepfoldId() != null) { +// scTransitionInfo.setSheepfoldId(sheep.getSheepfoldId()); +// } +// if (StringUtils.isBlank(scTransitionInfo.getTransFrom()) && sheep.getRanchId() != null) { +// DaRanch ranch = daRanchService.selectDaRanchById(sheep.getRanchId()); +// if (ranch != null) { +// scTransitionInfo.setTransFrom(ranch.getRanch()); +// } +// } +// } else { +// throw new RuntimeException("耳号不能为空"); +// } +// +// scTransitionInfo.setStatus(0); +// scTransitionInfo.setCreateTime(DateUtils.getNowDate()); +// return scTransitionInfoMapper.insertScTransitionInfo(scTransitionInfo); +// } /** @@ -141,6 +150,15 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService } info.setSheepId(sheep.getId().intValue()); info.setVarietyId(sheep.getVarietyId()); + if (info.getSheepfoldId() == null && sheep.getSheepfoldId() != null) { + info.setSheepfoldId(sheep.getSheepfoldId()); + } + if (StringUtils.isBlank(info.getTransFrom()) && sheep.getRanchId() != null) { + DaRanch ranch = daRanchService.selectDaRanchById(sheep.getRanchId()); + if (ranch != null) { + info.setTransFrom(ranch.getRanch()); + } + } } else { throw new RuntimeException("耳号不能为空"); } diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml index 4b5fcfa..103a98d 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml @@ -91,53 +91,54 @@ WHERE t.id = #{id} - - insert into sc_transition_info - - sheep_id, - variety_id, - trans_to, - trans_from, - event_type, - trans_type, - transition_date, - technician, - status, - comment, - create_by, - create_time, - user_id, - dept_id, - - - #{sheepId}, - #{varietyId}, - #{transTo}, - #{transFrom}, - #{eventType}, - #{transType}, - #{transitionDate}, - #{technician}, - #{status}, - #{comment}, - #{createBy}, - #{createTime}, - #{userId}, - #{deptId}, - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO sc_transition_info ( - sheep_id, variety_id, trans_to, trans_from, + sheep_id,sheepfold_id, variety_id, trans_to, trans_from, event_type,trans_type, transition_date, technician, status, comment, - create_by, create_time + create_by, create_time,user_id,dept_id ) VALUES ( - #{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType}, + #{item.sheepId},#{item.sheepfoldId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType}, #{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment}, - #{item.createBy}, now() + #{item.createBy}, now(), #{item.userId}, + #{item.deptId} ) From b84c35fe650d4ead7c9cad18b9c2258704ffdf53 Mon Sep 17 00:00:00 2001 From: ll <1079863556@qq.com> Date: Mon, 9 Feb 2026 21:57:19 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sale/controller/SxCustomerController.java | 79 ++++++++++++++++--- .../zhyc/module/sale/domain/SxCustomer.java | 5 ++ .../module/sale/domain/SxCustomerExport.java | 58 +++++++++++--- .../mapper/sale/SxCustomerMapper.xml | 19 ++++- 4 files changed, 134 insertions(+), 27 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxCustomerController.java b/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxCustomerController.java index 5fc7735..0c09308 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxCustomerController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxCustomerController.java @@ -1,27 +1,44 @@ package com.zhyc.module.sale.controller; import java.util.List; +import java.util.Date; // 【修改点1】新增导入Date包 import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import com.zhyc.common.annotation.Log; import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.enums.BusinessType; import com.zhyc.module.sale.domain.SxCustomer; -import com.zhyc.module.sale.domain.SxCustomerExport; // 新增导入 +import com.zhyc.module.sale.domain.SxCustomerExport; import com.zhyc.module.sale.service.ISxCustomerService; import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.core.page.TableDataInfo; +/** + * 客户管理Controller + * + * @author ruoyi + * @date 2025-08-18 + */ @RestController @RequestMapping("/customer/customer") public class SxCustomerController extends BaseController { @Autowired private ISxCustomerService sxCustomerService; + /** + * 查询客户管理列表 + */ @PreAuthorize("@ss.hasPermi('customer:customer:list')") @GetMapping("/list") public TableDataInfo list(SxCustomer sxCustomer) { @@ -30,6 +47,9 @@ public class SxCustomerController extends BaseController { return getDataTable(list); } + /** + * 导出客户管理列表 + */ @PreAuthorize("@ss.hasPermi('customer:customer:export')") @Log(title = "客户管理", businessType = BusinessType.EXPORT) @PostMapping("/export") @@ -41,14 +61,22 @@ public class SxCustomerController extends BaseController { SxCustomerExport exportItem = new SxCustomerExport(); exportItem.setName(customer.getName()); exportItem.setPhone(customer.getPhone()); - // 拼接完整地址 - exportItem.setFullAddress( - (customer.getProvince() != null ? customer.getProvince() : "") + - (customer.getCity() != null ? customer.getCity() : "") + - (customer.getDistrict() != null ? customer.getDistrict() : "") + - (customer.getAddress() != null ? customer.getAddress() : "") - ); - exportItem.setRemark(customer.getRemark()); + + // 拼接所在地区 (省 + 市 + 区) + String area = (customer.getProvince() != null ? customer.getProvince() : "") + + (customer.getCity() != null ? customer.getCity() : "") + + (customer.getDistrict() != null ? customer.getDistrict() : ""); + exportItem.setArea(area); + + // 详细地址 + exportItem.setAddress(customer.getAddress()); + + // 创建人 (从BaseEntity获取) + exportItem.setCreateBy(customer.getCreateBy()); + + // 创建日期 (从BaseEntity获取) + exportItem.setCreateTime(customer.getCreateTime()); + return exportItem; }).collect(Collectors.toList()); @@ -56,29 +84,54 @@ public class SxCustomerController extends BaseController { util.exportExcel(response, exportList, "客户管理数据"); } + /** + * 获取客户管理详细信息 + */ @PreAuthorize("@ss.hasPermi('customer:customer:query')") - @GetMapping("/{id}") - public AjaxResult getInfo(@PathVariable Long id) { + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(sxCustomerService.selectSxCustomerById(id)); } + /** + * 新增客户管理 + */ @PreAuthorize("@ss.hasPermi('customer:customer:add')") @Log(title = "客户管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SxCustomer sxCustomer) { - // 【新增】自动填充当前登录用户的 userId 和 deptId + // 自动填充当前登录用户的 userId 和 deptId sxCustomer.setUserId(getUserId()); sxCustomer.setDeptId(getDeptId()); + + // 自动填充创建人 + sxCustomer.setCreateBy(getUsername()); + + // 【修改点2】自动填充创建时间为当前时间 + sxCustomer.setCreateTime(new Date()); + return toAjax(sxCustomerService.insertSxCustomer(sxCustomer)); } + /** + * 修改客户管理 + */ @PreAuthorize("@ss.hasPermi('customer:customer:edit')") @Log(title = "客户管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SxCustomer sxCustomer) { + // 自动填充更新人 + sxCustomer.setUpdateBy(getUsername()); + + // 【修改点3】自动填充更新时间为当前时间 + sxCustomer.setUpdateTime(new Date()); + return toAjax(sxCustomerService.updateSxCustomer(sxCustomer)); } + /** + * 删除客户管理 + */ @PreAuthorize("@ss.hasPermi('customer:customer:remove')") @Log(title = "客户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomer.java b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomer.java index c6f717b..db96f1d 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomer.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomer.java @@ -122,6 +122,7 @@ public class SxCustomer extends BaseEntity { @Override public String toString() { + // 修改:补充 BaseEntity 中的创建人、创建时间等重要字段,便于日志排查 return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("name", getName()) @@ -133,6 +134,10 @@ public class SxCustomer extends BaseEntity { .append("remark", getRemark()) .append("userId", getUserId()) .append("deptId", getDeptId()) + .append("createBy", getCreateBy()) // 补充创建人 + .append("createTime", getCreateTime()) // 补充创建时间 + .append("updateBy", getUpdateBy()) // 补充更新人 + .append("updateTime", getUpdateTime()) // 补充更新时间 .toString(); } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java index 168563c..916c461 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java @@ -1,7 +1,11 @@ package com.zhyc.module.sale.domain; import com.zhyc.common.annotation.Excel; +import java.util.Date; +/** + * 客户管理导出对象 + */ public class SxCustomerExport { @Excel(name = "客户名称") private String name; @@ -9,11 +13,23 @@ public class SxCustomerExport { @Excel(name = "客户电话") private String phone; - @Excel(name = "客户地址") - private String fullAddress; + /** 新增:所在地区 */ + @Excel(name = "所在地区") + private String area; - @Excel(name = "备注") - private String remark; + /** 新增:详细地址 */ + @Excel(name = "详细地址") + private String address; + + /** 新增:创建人 */ + @Excel(name = "创建人") + private String createBy; + + /** 新增:创建日期 */ + @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date createTime; + + // --- 以下是 Getter 和 Setter 方法,必须包含 --- public String getName() { return name; @@ -31,19 +47,35 @@ public class SxCustomerExport { this.phone = phone; } - public String getFullAddress() { - return fullAddress; + public String getArea() { + return area; } - public void setFullAddress(String fullAddress) { - this.fullAddress = fullAddress; + public void setArea(String area) { + this.area = area; } - public String getRemark() { - return remark; + public String getAddress() { + return address; } - public void setRemark(String remark) { - this.remark = remark; + public void setAddress(String address) { + this.address = address; } -} + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/sale/SxCustomerMapper.xml b/zhyc-module/src/main/resources/mapper/sale/SxCustomerMapper.xml index b6f20ac..f631c68 100644 --- a/zhyc-module/src/main/resources/mapper/sale/SxCustomerMapper.xml +++ b/zhyc-module/src/main/resources/mapper/sale/SxCustomerMapper.xml @@ -13,10 +13,14 @@ + + + + - SELECT c.id, c.name, c.phone, c.province, c.city, c.district, c.address, c.remark, c.user_id, c.dept_id + SELECT c.id, c.name, c.phone, c.province, c.city, c.district, c.address, c.remark, c.user_id, c.dept_id, c.create_by, c.create_time, c.update_by, c.update_time FROM sx_customer c @@ -24,6 +28,9 @@ AND c.name LIKE CONCAT('%', #{name}, '%') + AND c.province = #{province} + AND c.city = #{city} + AND c.district = #{district} ${params.dataScope} @@ -45,6 +52,10 @@ remark, user_id, dept_id, + create_by, + create_time, + update_by, + update_time, #{name}, @@ -56,6 +67,10 @@ #{remark}, #{userId}, #{deptId}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, @@ -69,6 +84,8 @@ district = #{district}, address = #{address}, remark = #{remark}, + update_by = #{updateBy}, + update_time = #{updateTime}, WHERE id = #{id} From 708589b4203a6c8266a5939dd416b0c2766c2c0c Mon Sep 17 00:00:00 2001 From: zyh <2066096076@qq.com> Date: Tue, 10 Feb 2026 13:30:35 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BE=8A=E5=8F=AA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zhyc/module/base/domain/BasSheep.java | 8 ++++ .../manage_sheep/domain/ScAddSheep.java | 28 ++++++++---- .../service/impl/ScAddSheepServiceImpl.java | 43 ++++++++++++++++--- .../impl/ScTransitionInfoServiceImpl.java | 2 +- .../produce/manage_sheep/ScAddSheepMapper.xml | 8 ++++ 5 files changed, 75 insertions(+), 14 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java index 92c683b..cc608df 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java @@ -103,6 +103,14 @@ public class BasSheep extends BaseEntity @Excel(name = "母号id") private Long motherId; + /** 外祖父耳号 */ + @Excel(name = "外祖父") + private String grandpa; + + /** 外祖母耳号 */ + @Excel(name = "外祖母") + private String grandma; + /** 受体id */ @Excel(name = "受体id") private Long receptorId; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java index 6d99be7..a909a90 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java @@ -56,6 +56,25 @@ public class ScAddSheep extends BaseEntity { */ @Excel(name = "母号") private String mother; + + /** + * 外祖父耳号 + */ + @Excel(name = "外祖父") + private String grandpa; + + /** + * 外祖母耳号 + */ + @Excel(name = "外祖母") + private String grandma; + + /** + * 出生体重 + */ + @Excel(name = "出生体重") + private BigDecimal bornWeight; + /** * 断奶体重(仅接收,不入库) */ @@ -63,11 +82,7 @@ public class ScAddSheep extends BaseEntity { private BigDecimal weaningWeight; private String createBy; private Date createTime; - /** - * 出生体重 - */ - @Excel(name = "出生体重") - private BigDecimal bornWeight; + /** * 出生日期 @@ -103,7 +118,6 @@ public class ScAddSheep extends BaseEntity { * 羊只类别 */ private Long typeId; - @Excel(name = "羊只类型") private String typeName; /** @@ -116,13 +130,11 @@ public class ScAddSheep extends BaseEntity { /** * 备注 */ - @Excel(name = "备注") private String comment; /** * 技术员 */ - @Excel(name = "技术员") private String technician; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java index 23cc7ba..23949e0 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java @@ -52,7 +52,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { throw new ServiceException("添加失败,耳号已存在"); } - // userId 和 deptId 已在 Controller 中设置,直接插入 boolean ok = scAddSheepMapper.insert(scAddSheep) > 0; if (!ok) return false; @@ -60,10 +59,28 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { bs.setManageTags(scAddSheep.getEarNumber()); bs.setRanchId(scAddSheep.getRanchId().longValue()); bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); - bs.setFatherId(null); - bs.setMotherId(null); + if (StringUtils.isNotBlank(scAddSheep.getFather())) { + BasSheep fatherSheep = basSheepService.selectBasSheepByManageTags(scAddSheep.getFather().trim()); + if (fatherSheep == null) { + throw new ServiceException("父号【" + scAddSheep.getFather() + "】不存在"); + } + bs.setFatherId(fatherSheep.getId()); + } + if (StringUtils.isNotBlank(scAddSheep.getMother())) { + BasSheep motherSheep = basSheepService.selectBasSheepByManageTags(scAddSheep.getMother().trim()); + if (motherSheep == null) { + throw new ServiceException("母号【" + scAddSheep.getMother() + "】不存在"); + } + bs.setMotherId(motherSheep.getId()); + } + bs.setGrandpa(scAddSheep.getGrandpa()); + bs.setGrandma(scAddSheep.getGrandma()); bs.setBirthWeight(scAddSheep.getBornWeight().longValue()); - bs.setWeaningWeight(scAddSheep.getWeaningWeight().longValue()); + if (scAddSheep.getWeaningWeight() != null) { + bs.setWeaningWeight(scAddSheep.getWeaningWeight().longValue()); + } else { + bs.setWeaningWeight(null); + } bs.setSource(String.valueOf(2)); bs.setBirthday(scAddSheep.getBirthday()); bs.setGender(scAddSheep.getGender().longValue()); @@ -88,7 +105,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { //查询 @Override - @DataScope(deptAlias = "sas", userAlias = "sas") // sas 是 sc_add_sheep 的别名 + @DataScope(deptAlias = "sas", userAlias = "sas") public List selectScAddSheepList(ScAddSheep scAddSheep) { return scAddSheepMapper.selectScAddSheepList(scAddSheep); } @@ -208,7 +225,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { .append("】"); continue; } + if (StringUtils.isNotBlank(sheep.getFather())) { + BasSheep father = basSheepService.selectBasSheepByManageTags(sheep.getFather().trim()); + if (father == null) { + failure++; + failureMsg.append("
第").append(i + 1).append("行:父号不存在【").append(sheep.getFather()).append("】"); + continue; + } + } + if (StringUtils.isNotBlank(sheep.getMother())) { + BasSheep mother = basSheepService.selectBasSheepByManageTags(sheep.getMother().trim()); + if (mother == null) { + failure++; + failureMsg.append("
第").append(i + 1).append("行:母号不存在【").append(sheep.getMother()).append("】"); + continue; + } + } // 数据分离:设置用户和部门 sheep.setUserId(userId); sheep.setDeptId(deptId); diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java index 4c73612..719d2c4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java @@ -235,7 +235,7 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService BasSheep upd = new BasSheep(); upd.setId(sheep.getId()); upd.setRanchId(targetRanchId); - upd.setSheepfoldId(targetSheepfoldId); // 真正换舍 + upd.setSheepfoldId(targetSheepfoldId); basSheepMapper.updateBasSheep(upd); } } diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml index 514e9a4..0ca050e 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml @@ -12,6 +12,8 @@ + + @@ -36,6 +38,8 @@ sas.ranch_id, sas.father, sas.mother, + sas.grandpa, + sas.grandma, sas.born_weight, sas.birthday, sas.gender, @@ -90,6 +94,8 @@ ranch_id, father, mother, + grandpa, + grandma, born_weight, birthday, gender, @@ -110,6 +116,8 @@ #{ranchId}, #{father}, #{mother}, + #{grandpa}, + #{grandma}, #{bornWeight}, #{birthday}, #{gender}, From 38dc069ca172299f9fe62ee7da7335a9fb24a120 Mon Sep 17 00:00:00 2001 From: ll <1079863556@qq.com> Date: Tue, 10 Feb 2026 13:46:27 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=B0=E5=BD=95bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SxSheepSaleController.java | 30 ++- .../zhyc/module/sale/domain/SxSheepSale.java | 224 ++++++++++-------- .../module/sale/mapper/SxSheepSaleMapper.java | 15 ++ .../sale/service/ISxSheepSaleService.java | 14 +- .../service/impl/SxSheepSaleServiceImpl.java | 60 +++-- .../mapper/sale/SxSheepSaleMapper.xml | 117 +++++++-- 6 files changed, 334 insertions(+), 126 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java b/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java index 5cef249..7f93c77 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java @@ -1,6 +1,7 @@ package com.zhyc.module.sale.controller; import java.util.List; +import java.util.Date; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -65,7 +66,7 @@ public class SxSheepSaleController extends BaseController { public AjaxResult getInfo(@PathVariable("id") Long id) { SxSheepSale sxSheepSale = sxSheepSaleService.selectSxSheepSaleById(id); // 将数据库中的逗号分隔的耳号字符串转换为列表 - if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) { + if (sxSheepSale != null && sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) { sxSheepSale.setBsManageTagsList(java.util.Arrays.asList(sxSheepSale.getBsManageTags().split(","))); } return success(sxSheepSale); @@ -81,6 +82,11 @@ public class SxSheepSaleController extends BaseController { // 【新增】自动填充当前登录用户的 userId 和 deptId sxSheepSale.setUserId(getUserId()); sxSheepSale.setDeptId(getDeptId()); + + // 【新增】自动填充创建人和创建时间,以便列表查询时显示 + sxSheepSale.setCreatedBy(getUserId()); + sxSheepSale.setCreatedAt(new Date()); + return toAjax(sxSheepSaleService.insertSxSheepSale(sxSheepSale)); } @@ -117,4 +123,26 @@ public class SxSheepSaleController extends BaseController { } return AjaxResult.success(sheepInfo); } + + /** + * 根据羊舍ID获取羊只耳号列表 + */ + @GetMapping("/listSheepBySheepfoldId") + public AjaxResult listSheepBySheepfoldId(@RequestParam Long sheepfoldId) { + List list = sxSheepSaleService.selectSheepTagsBySheepfoldId(sheepfoldId); + return AjaxResult.success(list); + } + + /** + * 【新增】搜索耳号(模糊查询) + */ + @GetMapping("/searchEarNumbers") + public AjaxResult searchEarNumbers(@RequestParam("query") String query) { + try { + List earNumbers = sxSheepSaleService.searchEarNumbers(query); + return success(earNumbers); + } catch (Exception e) { + return error("搜索耳号失败:" + e.getMessage()); + } + } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java index 892727e..e3e0908 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java @@ -25,46 +25,10 @@ public class SxSheepSale extends BaseEntity { @Excel(name = "耳号") private String bsManageTags; - /** 羊舍ID(当时销售的羊舍) */ - @Excel(name = "羊舍ID", readConverterExp = "当=时销售的羊舍") - private Long sheepfoldId; - /** 品种快照 */ - @Excel(name = "品种快照") + @Excel(name = "品种") private String variety; - /** 羊只类别快照 */ - @Excel(name = "羊只类别快照") - private String sheepName; - - /** 性别快照 */ - @Excel(name = "性别快照") - private String gender; - - /** 月龄快照 */ - @Excel(name = "月龄快照") - private Long monthAge; - - /** 胎次快照 */ - @Excel(name = "胎次快照") - private Long parity; - - /** 繁育状态快照 */ - @Excel(name = "繁育状态快照") - private String breed; - - /** 产后天数快照 */ - @Excel(name = "产后天数快照") - private Long postLambingDay; - - /** 泌乳天数快照 */ - @Excel(name = "泌乳天数快照") - private Long lactationDay; - - /** 怀孕天数快照 */ - @Excel(name = "怀孕天数快照") - private Long lambingDay; - /** 事件类型 */ @Excel(name = "事件类型") private String eventType; @@ -74,6 +38,26 @@ public class SxSheepSale extends BaseEntity { @Excel(name = "销售日期", width = 30, dateFormat = "yyyy-MM-dd") private Date saleDate; + /** 羊只类别快照 */ + @Excel(name = "羊只类别") + private String sheepName; + + /** 性别快照 */ + @Excel(name = "性别") + private String gender; + + /** 月龄快照 */ + @Excel(name = "月龄") + private Long monthAge; + + /** 胎次快照 */ + @Excel(name = "胎次") + private Long parity; + + /** 【新增】当前重量(档案关联生成) */ + @Excel(name = "当前重量(kg)") + private BigDecimal currentWeight; + /** 计价方式 */ @Excel(name = "计价方式") private String pricingMethod; @@ -82,45 +66,37 @@ public class SxSheepSale extends BaseEntity { @Excel(name = "单价") private BigDecimal unitPrice; - /** 总价(自动计算) */ - @Excel(name = "总价", readConverterExp = "自=动计算") - private BigDecimal totalPrice; - - /** 总体重(按体重时输入) */ - @Excel(name = "总体重", readConverterExp = "按=体重时输入") - private BigDecimal totalWeight; - - /** 平均体重(自动) */ - @Excel(name = "平均体重", readConverterExp = "自=动") + /** 重量(单只羊重量:单只时为总体重,多只时为平均重) - 对应数据库 avg_weight */ + @Excel(name = "重量(kg)") private BigDecimal avgWeight; - /** 平均单只价格(自动) */ - @Excel(name = "平均单只价格", readConverterExp = "自=动") + /** 单只羊价格(单只羊销售时填的总价或计算的总价;多只羊销售时计算出每只羊的平均价格) */ + @Excel(name = "单只羊价格(元)") private BigDecimal avgPricePerSheep; /** 销售类别(dict_type = sale_type) */ - @Excel(name = "销售类别", readConverterExp = "d=ict_type,==,s=ale_type") + @Excel(name = "销售类别", dictType = "sale_type") private String saleType; - /** 疾病类型(dict_type = disea_type) */ - @Excel(name = "疾病类型", readConverterExp = "d=ict_type,==,d=isea_type") - private String diseaseType; + /** 【非数据库字段】客户名称 */ + @Excel(name = "客户名称") + private String customerName; - /** 次要原因 */ - @Excel(name = "次要原因") - private String secondaryReason; + /** 【非数据库字段】客户电话 */ + @Excel(name = "客户电话") + private String customerPhone; - /** 班组(dict_type = group) */ - @Excel(name = "班组", readConverterExp = "d=ict_type,==,g=roup") - private String groupCode; + /** 【新增】【非数据库字段】所在地区 */ + @Excel(name = "所在地区") + private String customerArea; - /** 客户ID(sx_customer.id) */ - @Excel(name = "客户ID", readConverterExp = "s=x_customer.id") - private Long customerId; + /** 【非数据库字段】客户地址 */ + @Excel(name = "详细地址") + private String customerAddress; - /** 销售人员ID(sys_user.id) */ - @Excel(name = "销售人员ID", readConverterExp = "s=ys_user.id") - private Long salesPersonId; + /** 【非数据库字段】销售人员姓名 */ + @Excel(name = "销售人员") + private String salesPersonName; /** 检疫证号 */ @Excel(name = "检疫证号") @@ -130,48 +106,91 @@ public class SxSheepSale extends BaseEntity { @Excel(name = "审批编号") private String approvalNo; - /** 技术员ID(sys_user.id) */ - @Excel(name = "技术员ID", readConverterExp = "s=ys_user.id") - private Long technicianId; + /** 疾病类型(dict_type = disease_type) */ + @Excel(name = "疾病类型", dictType = "disease_type") + private String diseaseType; - /** 处理人ID(sys_user.id) */ - @Excel(name = "处理人ID", readConverterExp = "s=ys_user.id") - private Long handlerId; + /** 次要原因 */ + @Excel(name = "次要原因") + private String secondaryReason; - /** 创建人ID(sys_user.id) */ - @Excel(name = "创建人ID", readConverterExp = "s=ys_user.id") - private Long createdBy; + /** 【非数据库字段】羊舍名称 */ + @Excel(name = "羊舍") + private String sheepfoldName; + + /** 班组(dict_type = group) */ + @Excel(name = "班组", dictType = "group") + private String groupCode; + + /** 繁育状态快照 */ + @Excel(name = "繁育状态") + private String breed; + + /** 产后天数快照 */ + @Excel(name = "销售时产后天数") + private Long postLambingDay; + + /** 泌乳天数快照 */ + @Excel(name = "销售时泌乳天数") + private Long lactationDay; + + /** 怀孕天数快照 */ + @Excel(name = "销售时怀孕天数") + private Long lambingDay; + + /** 【非数据库字段】技术员姓名 */ + @Excel(name = "技术员") + private String technicianName; + + /** 【非数据库字段】处理人姓名 */ + @Excel(name = "处理人") + private String handlerName; + + /** 【非数据库字段】创建人姓名 */ + @Excel(name = "创建人") + private String createdByName; /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd") private Date createdAt; + // --- 以下字段在导出中不显示,但在业务中需要 --- + + /** 总价(自动计算) */ + private BigDecimal totalPrice; + + /** 总体重(按体重时输入) */ + private BigDecimal totalWeight; + + /** 羊舍ID(当时销售的羊舍) */ + private Long sheepfoldId; + + /** 客户ID(sx_customer.id) */ + private Long customerId; + + /** 销售人员ID(sys_user.id) */ + private Long salesPersonId; + + /** 技术员ID(sys_user.id) */ + private Long technicianId; + + /** 处理人ID(sys_user.id) */ + private Long handlerId; + + /** 创建人ID(sys_user.id) */ + private Long createdBy; + /** 用户ID */ private Long userId; /** 部门ID */ private Long deptId; - // 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号 - private List bsManageTagsList; + // --- 非数据库辅助字段 --- - // 【新增】非数据库字段:客户名称(从客户表查询) - private String customerName; - // 【新增】非数据库字段:客户电话 - private String customerPhone; - // 【新增】非数据库字段:客户地址 - private String customerAddress; - // 【新增】非数据库字段:销售人员姓名 - private String salesPersonName; - // 【新增】非数据库字段:技术员姓名 - private String technicianName; - // 【新增】非数据库字段:处理人姓名 - private String handlerName; - // 【新增】非数据库字段:创建人姓名 - private String createdByName; - // 【新增】非数据库字段:羊舍名称 - private String sheepfoldName; + /** 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号 */ + private List bsManageTagsList; public void setId(Long id) { this.id = id; @@ -445,7 +464,6 @@ public class SxSheepSale extends BaseEntity { this.deptId = deptId; } - // 【新增】getter 和 setter 方法 public List getBsManageTagsList() { return bsManageTagsList; } @@ -518,6 +536,22 @@ public class SxSheepSale extends BaseEntity { this.sheepfoldName = sheepfoldName; } + public BigDecimal getCurrentWeight() { + return currentWeight; + } + + public void setCurrentWeight(BigDecimal currentWeight) { + this.currentWeight = currentWeight; + } + + public String getCustomerArea() { + return customerArea; + } + + public void setCustomerArea(String customerArea) { + this.customerArea = customerArea; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -559,11 +593,13 @@ public class SxSheepSale extends BaseEntity { .append("customerName", getCustomerName()) .append("customerPhone", getCustomerPhone()) .append("customerAddress", getCustomerAddress()) + .append("customerArea", getCustomerArea()) .append("salesPersonName", getSalesPersonName()) .append("technicianName", getTechnicianName()) .append("handlerName", getHandlerName()) .append("createdByName", getCreatedByName()) .append("sheepfoldName", getSheepfoldName()) + .append("currentWeight", getCurrentWeight()) .toString(); } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java b/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java index 8b6788f..a619358 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java @@ -65,4 +65,19 @@ public interface SxSheepSaleMapper { * @return 羊只信息 (只包含视图中的字段) */ public SxSheepSale selectSheepInfoByTag(@Param("bsManageTags") String bsManageTags); + + /** + * 根据羊舍ID查询存栏羊只耳号列表 + * @param sheepfoldId 羊舍ID + * @return 耳号列表 + */ + public List selectSheepTagsBySheepfoldId(Long sheepfoldId); + + /** + * 【新增】模糊查询羊只耳号列表(用于前端搜索补全) + * @param query 查询关键字 + * @return 耳号列表 + */ + public List searchEarNumbers(@Param("query") String query); + } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java b/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java index bbdc73a..7d647e0 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java @@ -59,9 +59,21 @@ public interface ISxSheepSaleService { public int deleteSxSheepSaleById(Long id); /** - * 【新增】根据耳号查询羊只信息 + * 根据耳号查询羊只信息 * @param bsManageTags 耳号 * @return 羊只信息 */ public SxSheepSale selectSheepInfoByTag(String bsManageTags); + + /** + * 根据羊舍ID查询存栏羊只耳号列表 + */ + public List selectSheepTagsBySheepfoldId(Long sheepfoldId); + + /** + * 【新增】模糊查询羊只耳号列表 + * @param query 查询关键字 + * @return 耳号列表 + */ + public List searchEarNumbers(String query); } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java index dc9c026..97cfaae 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.zhyc.common.annotation.DataScope; // 【新增】引入数据权限注解 +import com.zhyc.common.annotation.DataScope; import com.zhyc.module.sale.mapper.SxSheepSaleMapper; import com.zhyc.module.sale.domain.SxSheepSale; import com.zhyc.module.sale.service.ISxSheepSaleService; @@ -34,7 +34,6 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService { /** * 查询羊只销售记录列表 - * 【新增】添加数据权限过滤注解 * deptAlias = "s": 对应 Mapper.xml 中表 sx_sheep_sale 的别名 s * userAlias = "s": 对应 Mapper.xml 中表 sx_sheep_sale 的别名 s * @@ -55,10 +54,10 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService { */ @Override public int insertSxSheepSale(SxSheepSale sxSheepSale) { - // 1. 业务验证 (例如:销售日期不能为空,淘汰销售必须填写疾病类型等) + // 1. 业务验证 (必填项校验、级联校验) validateSalesFields(sxSheepSale); - // 2. 自动计算逻辑 + // 2. 自动计算逻辑 (价格、体重) calculateSalesFields(sxSheepSale); // 3. 设置默认事件类型 @@ -121,21 +120,34 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService { } /** - * 【新增】根据耳号查询羊只信息 + * 根据耳号查询羊只信息 */ @Override public SxSheepSale selectSheepInfoByTag(String bsManageTags) { return sxSheepSaleMapper.selectSheepInfoByTag(bsManageTags); } + @Override + public List selectSheepTagsBySheepfoldId(Long sheepfoldId) { + return sxSheepSaleMapper.selectSheepTagsBySheepfoldId(sheepfoldId); + } + /** - * 【新增】自动计算总价、平均体重、平均单只价格 + * 【新增】实现模糊查询耳号 + */ + @Override + public List searchEarNumbers(String query) { + return sxSheepSaleMapper.searchEarNumbers(query); + } + + /** + * 自动计算总价、平均体重、平均单只价格 */ private void calculateSalesFields(SxSheepSale sxSheepSale) { String pricingMethod = sxSheepSale.getPricingMethod(); BigDecimal unitPrice = sxSheepSale.getUnitPrice(); - // 获取羊只数量 + // 获取羊只数量,默认为1防止除零 int sheepCount = 1; if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) { sheepCount = sxSheepSale.getBsManageTagsList().size(); @@ -145,6 +157,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService { } if ("按个体".equals(pricingMethod)) { + // 按个体计算逻辑 // 总价 = 单价 * 数量 if (unitPrice != null) { sxSheepSale.setTotalPrice(unitPrice.multiply(new BigDecimal(sheepCount))); @@ -152,43 +165,60 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService { // 平均单只价格就是单价 sxSheepSale.setAvgPricePerSheep(unitPrice); + // 按个体时,无需计算平均体重,清空相关字段避免混淆(可视需求决定是否保留) + sxSheepSale.setAvgWeight(null); + } else if ("按体重".equals(pricingMethod)) { + // 按体重计算逻辑 BigDecimal totalWeight = sxSheepSale.getTotalWeight(); + // 总价 = 单价 * 总重量 if (unitPrice != null && totalWeight != null) { sxSheepSale.setTotalPrice(unitPrice.multiply(totalWeight)); } + // 平均体重 = 总重量 / 数量 if (totalWeight != null && sheepCount > 0) { sxSheepSale.setAvgWeight(totalWeight.divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP)); } + // 平均单只价格 = 总价 / 数量 if (sxSheepSale.getTotalPrice() != null && sheepCount > 0) { sxSheepSale.setAvgPricePerSheep(sxSheepSale.getTotalPrice().divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP)); } } - // 可以添加其他计价方式的逻辑 } /** - * 【新增】业务字段验证 + * 业务字段验证 */ private void validateSalesFields(SxSheepSale sxSheepSale) { - // 验证销售日期不能为空 + // 1. 基础必填校验 if (sxSheepSale.getSaleDate() == null) { throw new RuntimeException("销售日期不能为空!"); } + if (sxSheepSale.getTechnicianId() == null) { + throw new RuntimeException("技术员不能为空!"); + } + if (sxSheepSale.getHandlerId() == null) { + throw new RuntimeException("处理人不能为空!"); + } + if (sxSheepSale.getGroupCode() == null || sxSheepSale.getGroupCode().trim().isEmpty()) { + throw new RuntimeException("班组不能为空!"); + } + if (sxSheepSale.getPricingMethod() == null || sxSheepSale.getPricingMethod().trim().isEmpty()) { + throw new RuntimeException("计价方式不能为空!"); + } + // 2. 级联校验 String saleType = sxSheepSale.getSaleType(); - // 如果销售类别是"淘汰销售"或"淘汰屠宰",则疾病类型和班组不能为空 + // 如果销售类别是"淘汰销售"或"淘汰屠宰",则疾病类型不能为空 if ("淘汰销售".equals(saleType) || "淘汰屠宰".equals(saleType)) { - if (sxSheepSale.getDiseaseType() == null) { + if (sxSheepSale.getDiseaseType() == null || sxSheepSale.getDiseaseType().trim().isEmpty()) { throw new RuntimeException("淘汰销售或淘汰屠宰必须选择疾病类型!"); } - if (sxSheepSale.getGroupCode() == null) { - throw new RuntimeException("淘汰销售或淘汰屠宰必须选择班组!"); - } } + // 如果疾病类型是"病残羊",则次要原因不能为空 if ("病残羊".equals(sxSheepSale.getDiseaseType())) { if (sxSheepSale.getSecondaryReason() == null || sxSheepSale.getSecondaryReason().trim().isEmpty()) { diff --git a/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml b/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml index b312e02..b4c64a0 100644 --- a/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml +++ b/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml @@ -38,6 +38,17 @@ + + + + + + + + + + + @@ -45,6 +56,85 @@ from sx_sheep_sale s + + + + select bs_manage_tags, @@ -57,7 +147,8 @@ post_lambing_day, lactation_day, lambing_day, - sheepfold_id + sheepfold_id, + current_weight from sheep_file @@ -66,22 +157,18 @@ where bs_manage_tags = #{bsManageTags} - + SELECT bs_manage_tags + FROM sheep_file + WHERE sheepfold_id = #{sheepfoldId} - + SELECT DISTINCT bs_manage_tags + FROM sheep_file + WHERE bs_manage_tags LIKE CONCAT(#{query}, '%') + ORDER BY bs_manage_tags + LIMIT 50