From 7fb02aa6f894905c5c98ac622c774f806e9c9f88 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 17 一月 2024 11:57:49 +0800
Subject: [PATCH] 调整

---
 server/service/src/main/java/com/doumee/dao/business/model/Solutions.java               |   17 +
 server/company/src/main/java/com/doumee/api/business/WorktypeController.java            |    7 
 /dev/null                                                                               |    6 
 server/company/src/main/java/com/doumee/api/business/SolutionsController.java           |    6 
 server/service/src/main/java/com/doumee/service/business/SolutionsService.java          |    1 
 server/service/src/main/java/com/doumee/service/business/InsuranceService.java          |    2 
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java |  162 +++++++++++++++++++
 server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java  |    2 
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java |  191 +++++++++++++++++++++++
 server/company/src/main/java/com/doumee/api/business/InsuranceController.java           |   15 +
 server/service/src/main/java/com/doumee/dao/business/model/Insurance.java               |    9 
 server/platform/src/main/java/com/doumee/api/business/SolutionsController.java          |    8 +
 12 files changed, 405 insertions(+), 21 deletions(-)

diff --git a/server/company/src/main/java/com/doumee/api/business/InsuranceController.java b/server/company/src/main/java/com/doumee/api/business/InsuranceController.java
index a9a97aa..929f336 100644
--- a/server/company/src/main/java/com/doumee/api/business/InsuranceController.java
+++ b/server/company/src/main/java/com/doumee/api/business/InsuranceController.java
@@ -67,6 +67,14 @@
         return ApiResponse.success(null);
     }
 
+    @ApiOperation("鍚敤绂佺敤")
+    @PostMapping("/updateStatus")
+    @RequiresPermissions("business:insurance:update")
+    public ApiResponse updateStatus(@RequestBody Insurance insurance) {
+        insuranceService.updateStatus(insurance);
+        return ApiResponse.success(null);
+    }
+
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @RequiresPermissions("business:insurance:query")
@@ -74,6 +82,13 @@
         return ApiResponse.success(insuranceService.findPage(pageWrap));
     }
 
+    @ApiOperation("鏌ヨ鍒楄〃")
+    @PostMapping("/list")
+    @RequiresPermissions("business:insurance:query")
+    public ApiResponse<List<Insurance>> findList (@RequestBody  Insurance pageWrap) {
+        return ApiResponse.success(insuranceService.findList(pageWrap));
+    }
+
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
     @RequiresPermissions("business:insurance:exportExcel")
diff --git a/server/company/src/main/java/com/doumee/api/business/SolutionsController.java b/server/company/src/main/java/com/doumee/api/business/SolutionsController.java
index c13297e..224ba1e 100644
--- a/server/company/src/main/java/com/doumee/api/business/SolutionsController.java
+++ b/server/company/src/main/java/com/doumee/api/business/SolutionsController.java
@@ -73,6 +73,12 @@
     public ApiResponse<PageData<Solutions>> findPage (@RequestBody PageWrap<Solutions> pageWrap) {
         return ApiResponse.success(solutionsService.findPage(pageWrap));
     }
+    @ApiOperation("鍒楄〃鏌ヨ")
+    @PostMapping("/list")
+    @RequiresPermissions("business:solutions:query")
+    public ApiResponse<List<Solutions>> findList (@RequestBody Solutions pageWrap) {
+        return ApiResponse.success(solutionsService.findList(pageWrap));
+    }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
diff --git a/server/company/src/main/java/com/doumee/api/business/WorktypeController.java b/server/company/src/main/java/com/doumee/api/business/WorktypeController.java
index 590ee03..4665b32 100644
--- a/server/company/src/main/java/com/doumee/api/business/WorktypeController.java
+++ b/server/company/src/main/java/com/doumee/api/business/WorktypeController.java
@@ -6,6 +6,7 @@
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
+import com.doumee.core.utils.Constants;
 import com.doumee.dao.business.model.Worktype;
 import com.doumee.service.business.WorktypeService;
 import io.swagger.annotations.Api;
@@ -73,6 +74,12 @@
     public ApiResponse<PageData<Worktype>> findPage (@RequestBody PageWrap<Worktype> pageWrap) {
         return ApiResponse.success(worktypeService.findPage(pageWrap));
     }
+    @ApiOperation("鏍规嵁淇濋櫓鏂规缂栫爜鏌ヨ")
+    @PostMapping("/list")
+    @RequiresPermissions("business:worktype:query")
+    public ApiResponse<List<Worktype>> findList ( Worktype model) {
+        return ApiResponse.success(worktypeService.findList(model));
+    }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
diff --git a/server/db/business.brand.permissions.sql b/server/db/business.brand.permissions.sql
deleted file mode 100644
index 1c32e05..0000000
--- a/server/db/business.brand.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:brand:create', '鏂板缓鍝佺墝淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:brand:delete', '鍒犻櫎鍝佺墝淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:brand:update', '淇敼鍝佺墝淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:brand:query', '鏌ヨ鍝佺墝淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:brand:exportExcel', '瀵煎嚭鍝佺墝淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.cate_attr.permissions.sql b/server/db/business.cate_attr.permissions.sql
deleted file mode 100644
index a2ebd85..0000000
--- a/server/db/business.cate_attr.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateattr:create', '鏂板缓鍝佺被灞炴�ц鏍煎�间俊鎭〃', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateattr:delete', '鍒犻櫎鍝佺被灞炴�ц鏍煎�间俊鎭〃', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateattr:update', '淇敼鍝佺被灞炴�ц鏍煎�间俊鎭〃', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateattr:query', '鏌ヨ鍝佺被灞炴�ц鏍煎�间俊鎭〃', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateattr:exportExcel', '瀵煎嚭鍝佺被灞炴�ц鏍煎�间俊鎭〃(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.cate_budget.permissions.sql b/server/db/business.cate_budget.permissions.sql
deleted file mode 100644
index 2cf382a..0000000
--- a/server/db/business.cate_budget.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `MODULE`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:catebudget:create', '鏂板缓鍝佺被浠锋牸鍖洪棿琛�', '鍝佺被浠锋牸鍖洪棿琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `MODULE`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:catebudget:delete', '鍒犻櫎鍝佺被浠锋牸鍖洪棿琛�', '鍝佺被浠锋牸鍖洪棿琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `MODULE`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:catebudget:update', '淇敼鍝佺被浠锋牸鍖洪棿琛�', '鍝佺被浠锋牸鍖洪棿琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `MODULE`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:catebudget:query', '鏌ヨ鍝佺被浠锋牸鍖洪棿琛�', '鍝佺被浠锋牸鍖洪棿琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `MODULE`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:catebudget:exportExcel', '瀵煎嚭鍝佺被浠锋牸鍖洪棿琛�(Excel)', '鍝佺被浠锋牸鍖洪棿琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.cate_param.permissions.sql b/server/db/business.cate_param.permissions.sql
deleted file mode 100644
index 82201e7..0000000
--- a/server/db/business.cate_param.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateparam:create', '鏂板缓鍝佺被鍙傛暟淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateparam:delete', '鍒犻櫎鍝佺被鍙傛暟淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateparam:update', '淇敼鍝佺被鍙傛暟淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateparam:query', '鏌ヨ鍝佺被鍙傛暟淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:cateparam:exportExcel', '瀵煎嚭鍝佺被鍙傛暟淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.category.permissions.sql b/server/db/business.category.permissions.sql
deleted file mode 100644
index ceda860..0000000
--- a/server/db/business.category.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:category:create', '鏂板缓鍝佺被淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:category:delete', '鍒犻櫎鍝佺被淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:category:update', '淇敼鍝佺被淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:category:query', '鏌ヨ鍝佺被淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:category:exportExcel', '瀵煎嚭鍝佺被淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.goods.permissions.sql b/server/db/business.goods.permissions.sql
deleted file mode 100644
index b0149a5..0000000
--- a/server/db/business.goods.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goods:create', '鏂板缓鍟嗗搧淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goods:delete', '鍒犻櫎鍟嗗搧淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goods:update', '淇敼鍟嗗搧淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goods:query', '鏌ヨ鍟嗗搧淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goods:exportExcel', '瀵煎嚭鍟嗗搧淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.goods_param.permissions.sql b/server/db/business.goods_param.permissions.sql
deleted file mode 100644
index 10952cd..0000000
--- a/server/db/business.goods_param.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goodsparam:create', '鏂板缓鍟嗗搧鍙傛暟閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goodsparam:delete', '鍒犻櫎鍟嗗搧鍙傛暟閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goodsparam:update', '淇敼鍟嗗搧鍙傛暟閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goodsparam:query', '鏌ヨ鍟嗗搧鍙傛暟閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:goodsparam:exportExcel', '瀵煎嚭鍟嗗搧鍙傛暟閰嶇疆琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/business.multifile.permissions.sql b/server/db/business.multifile.permissions.sql
deleted file mode 100644
index de8ef71..0000000
--- a/server/db/business.multifile.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:multifile:create', '鏂板缓闄勪欢淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:multifile:delete', '鍒犻櫎闄勪欢淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:multifile:update', '淇敼闄勪欢淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:multifile:query', '鏌ヨ闄勪欢淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:multifile:exportExcel', '瀵煎嚭闄勪欢淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/db/cate_param_select.permissions.sql b/server/db/cate_param_select.permissions.sql
deleted file mode 100644
index 5e2b430..0000000
--- a/server/db/cate_param_select.permissions.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:create', '鏂板缓鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:delete', '鍒犻櫎鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:update', '淇敼鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:query', '鏌ヨ鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:exportExcel', '瀵煎嚭鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
-
diff --git a/server/platform/src/main/java/com/doumee/api/business/SolutionsController.java b/server/platform/src/main/java/com/doumee/api/business/SolutionsController.java
index c13297e..c074e6e 100644
--- a/server/platform/src/main/java/com/doumee/api/business/SolutionsController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/SolutionsController.java
@@ -67,6 +67,14 @@
         return ApiResponse.success(null);
     }
 
+    @ApiOperation("绂佺敤鍚敤")
+    @PostMapping("/updateStatus")
+    @RequiresPermissions("business:solutions:update")
+    public ApiResponse updateStatus(@RequestBody Solutions solutions) {
+        solutionsService.updateStatus(solutions);
+        return ApiResponse.success(null);
+    }
+
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @RequiresPermissions("business:solutions:query")
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/Insurance.java b/server/service/src/main/java/com/doumee/dao/business/model/Insurance.java
index 84d182a..23ca4b1 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/Insurance.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/Insurance.java
@@ -1,5 +1,6 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -9,6 +10,7 @@
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 淇濋櫓鍏徃淇℃伅琛�
@@ -67,12 +69,15 @@
     @ExcelColumn(name="鐗堟湰鍙�")
     private String version;
 
-    @ApiModelProperty(value = "璁板綍绫诲瀷 0鍩鸿〃鏁版嵁 1鍘嗗彶鐗堟湰鏁版嵁", example = "1")
-    @ExcelColumn(name="璁板綍绫诲瀷 0鍩鸿〃鏁版嵁 1鍘嗗彶鐗堟湰鏁版嵁")
+    @ApiModelProperty(value = "璁板綍绫诲瀷 0鍩鸿〃鏁版嵁 1鍘嗗彶鐗堟湰鏁版嵁 2鏈�鏂板巻鍙茬増鏈�", example = "1")
+    @ExcelColumn(name="璁板綍绫诲瀷 0鍩鸿〃鏁版嵁 1鍘嗗彶鐗堟湰鏁版嵁 2鏈�鏂板巻鍙茬増鏈�")
     private Integer dataType;
 
     @ApiModelProperty(value = "鍩鸿〃缂栫爜锛堣嚜鍏宠仈锛�", example = "1")
     @ExcelColumn(name="鍩鸿〃缂栫爜锛堣嚜鍏宠仈锛�")
     private Integer baseId;
+    @ApiModelProperty(value = "宸ョ闆嗗悎", example = "1")
+    @TableField(exist = false)
+    private List<Worktype> worktypeList;
 
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java b/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
index 2049f54..59d6ce2 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
@@ -1,5 +1,6 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -10,6 +11,7 @@
 import com.fasterxml.jackson.annotation.JsonFormat;
 import java.util.Date;
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * 淇濋櫓鏂规淇℃伅琛�
@@ -92,9 +94,9 @@
     @ExcelColumn(name="淇濋櫓鏃堕棿鍗曚綅0澶� 1鍗婃湀 2鏈� 3骞�")
     private Integer timeUnit;
 
-    @ApiModelProperty(value = "寮�鎴疯")
-    @ExcelColumn(name="寮�鎴疯")
-    private String insureCycle;
+    @ApiModelProperty(value = "鎶曚繚鍛ㄦ湡")
+    @ExcelColumn(name="鎶曚繚鍛ㄦ湡")
+    private Integer insureCycle;
 
     @ApiModelProperty(value = "鏈�灏忔姇淇濆懆鏈熸椂闂村崟浣�0澶� 1鍗婃湀 2鏈� 3骞�", example = "1")
     @ExcelColumn(name="鏈�灏忔姇淇濆懆鏈熸椂闂村崟浣�0澶� 1鍗婃湀 2鏈� 3骞�")
@@ -111,6 +113,9 @@
     @ApiModelProperty(value = "鎺ユ敹鏂囦欢閭")
     @ExcelColumn(name="鎺ユ敹鏂囦欢閭")
     private String email;
+    @ApiModelProperty(value = "鎵垮寘鍏徃")
+    @ExcelColumn(name="鎵垮寘鍏徃")
+    private String companyName;
 
     @ApiModelProperty(value = "鐗瑰埆绾﹀畾")
     @ExcelColumn(name="鐗瑰埆绾﹀畾")
@@ -143,4 +148,10 @@
     @ExcelColumn(name="鍩鸿〃缂栫爜锛堣嚜鍏宠仈锛�")
     private Integer baseId;
 
+
+    @ApiModelProperty(value = "宸ョ缂栫爜闆嗗悎", example = "1")
+    @TableField(exist = false)
+    private List<Integer> worktypeIdList;
+
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/InsuranceService.java b/server/service/src/main/java/com/doumee/service/business/InsuranceService.java
index 40e062d..032f6e1 100644
--- a/server/service/src/main/java/com/doumee/service/business/InsuranceService.java
+++ b/server/service/src/main/java/com/doumee/service/business/InsuranceService.java
@@ -94,4 +94,6 @@
      * @return long
      */
     long count(Insurance insurance);
+
+    void updateStatus(Insurance insurance);
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/SolutionsService.java b/server/service/src/main/java/com/doumee/service/business/SolutionsService.java
index 41ec3be..5f706b5 100644
--- a/server/service/src/main/java/com/doumee/service/business/SolutionsService.java
+++ b/server/service/src/main/java/com/doumee/service/business/SolutionsService.java
@@ -47,6 +47,7 @@
      * @param solutions 瀹炰綋瀵硅薄
      */
     void updateById(Solutions solutions);
+    void updateStatus(Solutions solutions);
 
     /**
      * 鎵归噺涓婚敭鏇存柊
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
index 50f3213..26ae0b7 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
@@ -1,20 +1,34 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.InsuranceMapper;
+import com.doumee.dao.business.WorktypeMapper;
 import com.doumee.dao.business.model.Insurance;
+import com.doumee.dao.business.model.Worktype;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.InsuranceService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 /**
  * 淇濋櫓鍏徃淇℃伅琛⊿ervice瀹炵幇
@@ -26,22 +40,113 @@
 
     @Autowired
     private InsuranceMapper insuranceMapper;
+    @Autowired
+    private WorktypeMapper worktypeMapper;
 
     @Override
+    @Transactional
     public Integer create(Insurance insurance) {
-        insuranceMapper.insert(insurance);
+
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        initCreateParam(insurance);//宸ョ鏁版嵁鏈夋晥鎬ф楠岋紝鍘婚櫎绌虹櫧琛屾暟鎹�
+
+        insurance.setIsdeleted(Constants.ZERO);
+        insurance.setCreator(user.getId());
+        insurance.setCreateDate(new Date());
+        insurance.setVersion(UUID.randomUUID().toString());//鐗堟湰鍙�
+        insurance.setDataType(Constants.ZERO);
+        insurance.setStatus(Constants.ZERO);
+        insuranceMapper.insert(insurance);//鍩虹鐗堟湰
+
+        //濡傛灉鏈夊伐绉嶏紝鍒欎骇鐢熶竴涓柊鐨勬湁鏁堝巻鍙茬増鏈� ~
+        Insurance newModel = new Insurance();
+        BeanUtils.copyProperties(insurance,newModel);
+        newModel.setId(null);
+        newModel.setBaseId(insurance.getId());
+        newModel.setDataType(Constants.TWO);
+        insuranceMapper.insert(newModel);
+
+        dealWorkTypeData(insurance,newModel,insurance.getWorktypeList(),true);
+
         return insurance.getId();
+    }
+    private void dealWorkTypeData(Insurance insurance, Insurance newModel, List<Worktype> worktypeList,boolean isNew) {
+        for(Worktype w : worktypeList) {
+            //鍩虹鐗堟湰
+            w.setInsuranceId(insurance.getId());
+            w.setIsdeleted(Constants.ZERO);
+            w.setCreator(newModel.getCreator());
+            w.setCreateDate(insurance.getCreateDate());
+            w.setDataType(insurance.getDataType());
+            w.setStatus(Constants.ZERO);
+            w.setVersion(insurance.getVersion());
+            worktypeMapper.insert(w);
+
+            //鍘嗗彶鐗堟湰鐨勫伐绉嶄俊鎭�
+            Worktype newType = new Worktype();
+            BeanUtils.copyProperties(w, newType);
+            newType.setInsuranceId(newModel.getId());
+            newType.setBaseId(w.getId());
+            newType.setDataType(Constants.ONE);
+            newType.setVersion(newModel.getVersion());
+            worktypeMapper.insert(newType);
+        }
+    }
+
+    private void initCreateParam(Insurance insurance) {
+        if(StringUtils.isBlank(insurance.getName())){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇疯緭鍏ヤ繚闄╁叕鍙稿悕绉帮紒");
+        }
+        List<Worktype> worktypeList = new ArrayList<>();
+        if(insurance.getWorktypeList()!=null && insurance.getWorktypeList().size()>0){
+            for(Worktype w : insurance.getWorktypeList()){
+                if(StringUtils.isNotBlank(w.getName())){
+                    worktypeList.add(w);
+                }
+            }
+        }
+        if(worktypeList.size()==0){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝宸ョ涓嶈兘涓虹┖锛�");
+        }
+        insurance.setWorktypeList(worktypeList);
     }
 
     @Override
     public void deleteById(Integer id) {
-        insuranceMapper.deleteById(id);
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        Insurance model = findById(id);
+        if(model == null || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        Insurance update = new Insurance();
+        update.setIsdeleted(Constants.ZERO);
+        update.setEditDate(new Date());
+        update.setEditor(user.getId());
+        update.setId(id);
+        insuranceMapper.updateById(update);
+
+        //閫昏緫鍒犻櫎鎵�鏈夊伐绉嶆暟鎹�
+        worktypeMapper.update(null,new UpdateWrapper<Worktype>()
+                .lambda()
+                .eq(Worktype::getInsuranceId,id)
+                .eq(Worktype::getIsdeleted,Constants.ZERO)
+                .set(Worktype::getIsdeleted,Constants.ONE)
+         );
     }
 
     @Override
     public void delete(Insurance insurance) {
-        UpdateWrapper<Insurance> deleteWrapper = new UpdateWrapper<>(insurance);
-        insuranceMapper.delete(deleteWrapper);
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        Insurance model = findById(insurance.getId());
+        if(model == null || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        Insurance update = new Insurance();
+        update.setIsdeleted(Constants.ZERO);
+        update.setEditDate(new Date());
+        update.setId(insurance.getId());
+        update.setEditor(user.getId());
+        insuranceMapper.updateById(update);
     }
 
     @Override
@@ -54,7 +159,74 @@
 
     @Override
     public void updateById(Insurance insurance) {
-        insuranceMapper.updateById(insurance);
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        Insurance model = findById(insurance.getId());
+        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)
+                || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        //鏁版嵁鏈夋晥鎬ф牎楠�
+        initCreateParam(insurance);
+
+        Insurance updateModel = new Insurance();
+        updateModel.setEditor(user.getId());
+        updateModel.setName(insurance.getName());
+        updateModel.setId(model.getId());
+        updateModel.setVersion(UUID.randomUUID().toString());
+        updateModel.setEditDate(new Date());
+        updateModel.setRemark(insurance.getRemark());
+        updateModel.setSortnum(insurance.getSortnum());
+        insuranceMapper.updateById(updateModel);
+
+        //濡傛灉淇敼锛屽垯浜х敓涓�涓柊鐨勫巻鍙茬増鏈� ~
+        Insurance newModel = new Insurance();
+        BeanUtils.copyProperties(model,newModel);
+        newModel.setId(null);
+        newModel.setVersion(updateModel.getVersion());
+        newModel.setCreateDate(new Date());
+        newModel.setBaseId(insurance.getId());
+        newModel.setDataType(Constants.TWO);
+        insuranceMapper.insert(newModel);
+
+        //鍒犻櫎鎵�鏈夊伐绉嶆暟鎹�
+        worktypeMapper.delete(new UpdateWrapper<Worktype>()
+                .lambda()
+                .eq(Worktype::getInsuranceId,insurance.getId())
+        );
+        insuranceMapper.update(null,new UpdateWrapper<Insurance>()
+                .lambda()
+                .eq(Insurance::getBaseId,insurance.getId())
+                .eq(Insurance::getDataType,Constants.TWO)
+                .set(Insurance::getDataType,Constants.ONE)
+        );
+        //澶勭悊宸ヤ綔淇℃伅锛屾柊澧炴渶鏂扮殑锛屽悓鏃朵骇鐢熷巻鍙茬増鏈�
+        dealWorkTypeData(updateModel,newModel,insurance.getWorktypeList(),false);
+    }
+
+    @Override
+    public void updateStatus(Insurance insurance){
+        if(insurance.getId() == null || insurance.getStatus()==null || insurance.getStatus()<0||insurance.getStatus()>1){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST );
+        }
+        Insurance model = findById(insurance.getId());
+        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)
+                || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        if(Constants.equalsInteger(model.getStatus(),insurance.getStatus())){
+            //濡傛灉鐘舵�佷笉鍙戠敓鏀瑰彉锛岀洿鎺ヨ繑鍥�
+            return;
+        }
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        //鍚屾椂鏇存柊鍩鸿〃鍜屽巻鍙茬増鏈墍鏈夋暟鎹姸鎬�
+        insuranceMapper.update(null,new UpdateWrapper<Insurance>()
+                .lambda()
+                 .and(m -> m.eq(Insurance::getId,model.getId()).or().eq(Insurance::getBaseId,model.getId()))
+                .eq(Insurance::getIsdeleted,Constants.ZERO)
+                .set(Insurance::getEditDate,new Date())
+                .set(Insurance::getEditor,user.getId())
+                .set(Insurance::getStatus,insurance.getStatus())
+        );
     }
 
     @Override
@@ -80,6 +252,7 @@
 
     @Override
     public List<Insurance> findList(Insurance insurance) {
+        insurance.setIsdeleted(Constants.ZERO);
         QueryWrapper<Insurance> wrapper = new QueryWrapper<>(insurance);
         return insuranceMapper.selectList(wrapper);
     }
@@ -89,6 +262,8 @@
         IPage<Insurance> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
         QueryWrapper<Insurance> queryWrapper = new QueryWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
+        pageWrap.getModel().setDataType(Constants.ZERO);//鍙�夋嫨鍩鸿〃鏁版嵁
+        pageWrap.getModel().setIsdeleted(Constants.ZERO);
         if (pageWrap.getModel().getId() != null) {
             queryWrapper.lambda().eq(Insurance::getId, pageWrap.getModel().getId());
         }
@@ -130,13 +305,15 @@
         if (pageWrap.getModel().getBaseId() != null) {
             queryWrapper.lambda().eq(Insurance::getBaseId, pageWrap.getModel().getBaseId());
         }
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
+ /*       for(PageWrap.SortData sortData: pageWrap.getSorts()) {
             if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                 queryWrapper.orderByDesc(sortData.getProperty());
             } else {
                 queryWrapper.orderByAsc(sortData.getProperty());
             }
-        }
+
+        }*/
+        queryWrapper.lambda().orderByAsc(Insurance::getSortnum);
         return PageData.from(insuranceMapper.selectPage(page, queryWrapper));
     }
 
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
index c4fda33..b04d642 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -1,20 +1,33 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.InsuranceMapper;
+import com.doumee.dao.business.SolutionWorktypeMapper;
 import com.doumee.dao.business.SolutionsMapper;
-import com.doumee.dao.business.model.Solutions;
+import com.doumee.dao.business.WorktypeMapper;
+import com.doumee.dao.business.model.*;
 import com.doumee.service.business.SolutionsService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 /**
  * 淇濋櫓鏂规淇℃伅琛⊿ervice瀹炵幇
@@ -26,11 +39,91 @@
 
     @Autowired
     private SolutionsMapper solutionsMapper;
+    @Autowired
+    private WorktypeMapper worktypeMapper;
+    @Autowired
+    private SolutionWorktypeMapper solutionWorktypeMapper;
+    @Autowired
+    private InsuranceMapper insuranceMapper;
 
     @Override
     public Integer create(Solutions solutions) {
-        solutionsMapper.insert(solutions);
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        initCreateParam(solutions);//宸ョ鏁版嵁鏈夋晥鎬ф楠岋紝鍘婚櫎绌虹櫧琛屾暟鎹�
+
+        solutions.setIsdeleted(Constants.ZERO);
+        solutions.setCreator(user.getId());
+        solutions.setCreateDate(new Date());
+        solutions.setVersion(UUID.randomUUID().toString());//鐗堟湰鍙�
+        solutions.setDataType(Constants.ZERO);
+        solutions.setStatus(Constants.ZERO);
+        solutionsMapper.insert(solutions);//鍩虹鐗堟湰
+
+        //濡傛灉鏈夊伐绉嶏紝鍒欎骇鐢熶竴涓柊鐨勬湁鏁堝巻鍙茬増鏈� ~
+        Solutions newModel = new Solutions();
+        BeanUtils.copyProperties(solutions,newModel);
+        newModel.setId(null);
+        newModel.setBaseId(solutions.getId());
+        newModel.setDataType(Constants.TWO);
+        solutionsMapper.insert(newModel);
+
+        dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),true);
         return solutions.getId();
+    }
+
+    private void dealWorkType(Solutions solutions, Solutions newModel, List<Integer> worktypeIdList, boolean b) {
+        Insurance  model = insuranceMapper.selectById(solutions.getInsuranceId());
+        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)
+                || !Constants.equalsInteger(model.getDataType(),Constants.TWO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ヤ繚闄╁叕鍙镐俊鎭笉瀛樺湪锛岃灏濊瘯鍒锋柊椤甸潰閲嶈瘯~" );
+        }
+        if( !Constants.equalsInteger(model.getStatus(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ヤ繚闄╁叕鍙稿凡琚紝璇峰皾璇曞埛鏂伴〉闈㈤噸璇晘" );
+        }
+        List<Worktype> worktypeList = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda()
+                .eq(Worktype::getInsuranceId,solutions.getInsuranceId())
+                .eq(Worktype::getIsdeleted,Constants.ZERO)
+                .in(Worktype::getId,worktypeIdList));
+        if(worktypeList==null ||worktypeIdList.size()==0){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝宸ョ淇℃伅閫夋嫨鏈夎锛岃灏濊瘯鍒锋柊椤甸潰閲嶈瘯~" );
+        }
+
+        for(Worktype type : worktypeList) {
+            //鍩虹鐗堟湰
+            SolutionWorktype w = new SolutionWorktype();
+            w.setSolutionId(solutions.getId());
+            w.setIsdeleted(Constants.ZERO);
+            w.setCreator(newModel.getCreator());
+            w.setCreateDate(solutions.getCreateDate());
+            w.setWorktypeId(type.getId());
+            w.setStatus(Constants.ZERO);
+            solutionWorktypeMapper.insert(w);
+
+            //鍘嗗彶鐗堟湰鐨勫伐绉嶄俊鎭�
+            SolutionWorktype newType = new SolutionWorktype();
+            BeanUtils.copyProperties(w, newType);
+            newType.setSolutionId(newModel.getId());
+            solutionWorktypeMapper.insert(newType);
+        }
+
+    }
+
+    private void initCreateParam(Solutions solutions) {
+        if(StringUtils.isBlank(solutions.getName())
+                ||solutions.getInsuranceId()==null
+                ||solutions.getWorktypeIdList()==null
+                ||solutions.getWorktypeIdList().size()==0
+                ||Constants.formatIntegerNum(solutions.getMaxAge()) < 0
+                ||Constants.formatIntegerNum(solutions.getMinAge()) < 0
+                ||Constants.formatIntegerNum(solutions.getPriceCycleUnit()) < 0
+                ||Constants.formatIntegerNum(solutions.getInsureCycle()) < 0
+                ||Constants.formatIntegerNum(solutions.getInsureCycleUnit()) < 0
+                || solutions.getMinAge() >solutions.getMaxAge()
+                || Constants.formatBigdecimal(solutions.getPrice()).compareTo(new BigDecimal(0)) !=1
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+
     }
 
     @Override
@@ -54,7 +147,43 @@
 
     @Override
     public void updateById(Solutions solutions) {
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        Solutions model = findById(solutions.getId());
+        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)
+                || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        //鏁版嵁鏈夋晥鎬ф牎楠�
+        initCreateParam(solutions);
+
+        solutions.setEditor(user.getId());
+        solutions.setVersion(UUID.randomUUID().toString());
+        solutions.setEditDate(new Date());
         solutionsMapper.updateById(solutions);
+
+        //濡傛灉淇敼锛屽垯浜х敓涓�涓柊鐨勫巻鍙茬増鏈� ~
+        Solutions newModel = new Solutions();
+        BeanUtils.copyProperties(model,newModel);
+        newModel.setId(null);
+        newModel.setVersion(solutions.getVersion());
+        newModel.setCreateDate(new Date());
+        newModel.setBaseId(solutions.getId());
+        newModel.setDataType(Constants.TWO);
+        solutionsMapper.insert(newModel);
+
+        //鍒犻櫎鎵�鏈夊伐绉嶆暟鎹�
+        solutionWorktypeMapper.delete(new UpdateWrapper<SolutionWorktype>()
+                .lambda()
+                .eq(SolutionWorktype::getSolutionId,solutions.getId())
+        );
+        solutionsMapper.update(null,new UpdateWrapper<Solutions>()
+                .lambda()
+                .eq(Solutions::getBaseId,solutions.getId())
+                .eq(Solutions::getDataType,Constants.TWO)
+                .set(Solutions::getDataType,Constants.ONE)
+        );
+        //澶勭悊宸ヤ綔淇℃伅锛屾柊澧炴渶鏂扮殑锛屽悓鏃朵骇鐢熷巻鍙茬増鏈�
+        dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),false);
     }
 
     @Override
@@ -66,7 +195,31 @@
             this.updateById(solutions);
         }
     }
-
+    @Override
+    public void updateStatus(Solutions solutions){
+        if(solutions.getId() == null || solutions.getStatus()==null || solutions.getStatus()<0||solutions.getStatus()>1){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST );
+        }
+        Solutions model = findById(solutions.getId());
+        if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)
+            || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        if(Constants.equalsInteger(model.getStatus(),solutions.getStatus())){
+            //濡傛灉鐘舵�佷笉鍙戠敓鏀瑰彉锛岀洿鎺ヨ繑鍥�
+            return;
+        }
+        LoginUserInfo user= (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        //鍚屾椂鏇存柊鍩鸿〃鍜屽巻鍙茬増鏈墍鏈夋暟鎹姸鎬�
+        solutionsMapper.update(null,new UpdateWrapper<Solutions>()
+                .lambda()
+                .and(m -> m.eq(Solutions::getId,model.getId()).or().eq(Solutions::getBaseId,model.getId()))
+                .eq(Solutions::getIsdeleted,Constants.ZERO)
+                .set(Solutions::getEditDate,new Date())
+                .set(Solutions::getEditor,user.getId())
+                .set(Solutions::getStatus,solutions.getStatus())
+        );
+    }
     @Override
     public Solutions findById(Integer id) {
         return solutionsMapper.selectById(id);
@@ -80,6 +233,7 @@
 
     @Override
     public List<Solutions> findList(Solutions solutions) {
+        solutions.setIsdeleted(Constants.ZERO);
         QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
         return solutionsMapper.selectList(wrapper);
     }
@@ -89,6 +243,8 @@
         IPage<Solutions> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
         QueryWrapper<Solutions> queryWrapper = new QueryWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
+        pageWrap.getModel().setDataType(Constants.ZERO);//鍙�夋嫨鍩鸿〃鏁版嵁
+        pageWrap.getModel().setIsdeleted(Constants.ZERO);
         if (pageWrap.getModel().getId() != null) {
             queryWrapper.lambda().eq(Solutions::getId, pageWrap.getModel().getId());
         }
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
index 95159d5..d330b4f 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.WorktypeMapper;
 import com.doumee.dao.business.model.Worktype;
@@ -80,6 +81,7 @@
 
     @Override
     public List<Worktype> findList(Worktype worktype) {
+        worktype.setIsdeleted(Constants.ZERO);
         QueryWrapper<Worktype> wrapper = new QueryWrapper<>(worktype);
         return worktypeMapper.selectList(wrapper);
     }

--
Gitblit v1.9.3