Yansen 2 年前
父节点
当前提交
5ae7033d42

二进制
db/ybai.db 查看文件


+ 47
- 7
src/main/java/com/yunzhi/inte/controller/GuaranteeDetailController.java 查看文件

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.inte.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONArray;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -49,12 +50,14 @@ public class GuaranteeDetailController extends BaseController {
49 50
     @ApiOperation("分页查询")
50 51
     @GetMapping("/guaranteeDetail")
51 52
     public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-                             @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
53
+                             @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
54
+                             @ApiParam("任务ID") @RequestParam(value ="guaranteeId") Integer guaranteeId) throws Exception {
53 55
 
54 56
         IPage<GuaranteeDetail> pg = new Page<>(pageNum, pageSize);
55
-        // QueryWrapper<GuaranteeDetail> queryWrapper = new QueryWrapper<>();
56
-        // queryWrapper.orderByDesc("create_date");
57
-        IPage<GuaranteeDetail> result = guaranteeDetailService.page(pg);
57
+        QueryWrapper<GuaranteeDetail> queryWrapper = new QueryWrapper<>();
58
+        queryWrapper.eq("guarantee_id", guaranteeId);
59
+        queryWrapper.orderByDesc("id");
60
+        IPage<GuaranteeDetail> result = guaranteeDetailService.page(pg, queryWrapper);
58 61
 
59 62
         return ResponseBean.success(result);
60 63
     }
@@ -67,11 +70,48 @@ public class GuaranteeDetailController extends BaseController {
67 70
      */
68 71
     @ApiOperation("新增数据")
69 72
     @PostMapping("/guaranteeDetail")
70
-    public ResponseBean add(GuaranteeDetail guaranteeDetail) throws Exception {
73
+    public ResponseBean add(@ApiParam("实例对象") @RequestBody GuaranteeDetail guaranteeDetail) throws Exception {
71 74
         guaranteeDetailService.save(guaranteeDetail);
72 75
         return ResponseBean.success(guaranteeDetail);
73 76
     }
74 77
 
78
+    /**
79
+     * 新增数据
80
+     *
81
+     * @param jsonStr 实例对象
82
+     * @return 实例对象
83
+     */
84
+    @ApiOperation("新增数据")
85
+    @PostMapping("/guaranteeDetail/batch")
86
+    public ResponseBean batch(@ApiParam("任务ID") @RequestParam(value ="guaranteeId") Integer guaranteeId,
87
+                              @ApiParam("实例对象") @RequestBody String jsonStr) throws Exception {
88
+        if (null == jsonStr || "".equals(jsonStr)) {
89
+            return ResponseBean.error("未找到需要保存的数据");
90
+        }
91
+
92
+        if (null == guaranteeId) {
93
+            return ResponseBean.error("未找到需要保存的数据");
94
+        }
95
+
96
+        List<GuaranteeDetail> list = JSONArray.parseArray(jsonStr, GuaranteeDetail.class);
97
+        if (null == list || list.size() < 1) {
98
+            return ResponseBean.error("未找到需要保存的数据");
99
+        }
100
+
101
+        // 先删除原有数据
102
+        QueryWrapper<GuaranteeDetail> queryWrapper = new QueryWrapper<>();
103
+        queryWrapper.eq("guarantee_id", guaranteeId);
104
+        guaranteeDetailService.remove(queryWrapper);
105
+
106
+        // 再批量插入
107
+        for (GuaranteeDetail item : list) {
108
+            item.setGuaranteeId(guaranteeId);
109
+        }
110
+
111
+        guaranteeDetailService.saveBatch(list);
112
+        return ResponseBean.success(list);
113
+    }
114
+
75 115
     /**
76 116
      * 更新数据
77 117
      *
@@ -80,7 +120,7 @@ public class GuaranteeDetailController extends BaseController {
80 120
      */
81 121
     @ApiOperation("更新数据")
82 122
     @PutMapping("/guaranteeDetail/{id}")
83
-    public ResponseBean edit(GuaranteeDetail guaranteeDetail) throws Exception {
123
+    public ResponseBean edit(@ApiParam("实例对象") @RequestBody GuaranteeDetail guaranteeDetail) throws Exception {
84 124
         guaranteeDetailService.updateById(guaranteeDetail);
85 125
         return ResponseBean.success(guaranteeDetail);
86 126
     }
@@ -94,7 +134,7 @@ public class GuaranteeDetailController extends BaseController {
94 134
     @ApiOperation("通过主键删除数据")
95 135
     @DeleteMapping("/guaranteeDetail/{id}")
96 136
     public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
97
-        guaranteeDetailService.removeLogicById(id);
137
+        guaranteeDetailService.removeById(id);
98 138
         return ResponseBean.success("success");
99 139
     }
100 140
 }

+ 8
- 2
src/main/java/com/yunzhi/inte/controller/GuaranteeTaskController.java 查看文件

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.inte.common.BaseController;
7 7
 import com.yunzhi.inte.common.ResponseBean;
8
+
9
+import java.util.Date;
8 10
 import java.util.List;
9 11
 import io.swagger.annotations.Api;
10 12
 import io.swagger.annotations.ApiOperation;
@@ -67,7 +69,9 @@ public class GuaranteeTaskController extends BaseController {
67 69
      */
68 70
     @ApiOperation("新增数据")
69 71
     @PostMapping("/guaranteeTask")
70
-    public ResponseBean add(GuaranteeTask guaranteeTask) throws Exception {
72
+    public ResponseBean add(@ApiParam("实例对象") @RequestBody GuaranteeTask guaranteeTask) throws Exception {
73
+        guaranteeTask.setStatus(1);
74
+        guaranteeTask.setCreateDate(new Date());
71 75
         guaranteeTaskService.save(guaranteeTask);
72 76
         return ResponseBean.success(guaranteeTask);
73 77
     }
@@ -80,7 +84,9 @@ public class GuaranteeTaskController extends BaseController {
80 84
      */
81 85
     @ApiOperation("更新数据")
82 86
     @PutMapping("/guaranteeTask/{id}")
83
-    public ResponseBean edit(GuaranteeTask guaranteeTask) throws Exception {
87
+    public ResponseBean edit(@ApiParam("对象ID") @PathVariable Integer id,
88
+                             @ApiParam("实例对象") @RequestBody GuaranteeTask guaranteeTask) throws Exception {
89
+        guaranteeTask.setId(id);
84 90
         guaranteeTaskService.updateById(guaranteeTask);
85 91
         return ResponseBean.success(guaranteeTask);
86 92
     }

+ 5
- 2
src/main/java/com/yunzhi/inte/entity/GuaranteeTask.java 查看文件

@@ -24,7 +24,7 @@ import lombok.experimental.Accessors;
24 24
 public class GuaranteeTask implements Serializable,Cloneable{
25 25
     /** id */
26 26
     @ApiModelProperty(name = "id",notes = "")
27
-    @TableId(value = "id", type = IdType.INPUT)
27
+    @TableId(value = "id", type = IdType.AUTO)
28 28
     private Integer id ;
29 29
     /** 受领人 */
30 30
     @ApiModelProperty(name = "受领人",notes = "")
@@ -58,7 +58,7 @@ public class GuaranteeTask implements Serializable,Cloneable{
58 58
     private String deputyPhone ;
59 59
     /** 通报时间 */
60 60
     @ApiModelProperty(name = "通报时间",notes = "")
61
-    private Date gotDate ;
61
+    private String gotDate ;
62 62
     /** 保障序号 */
63 63
     @ApiModelProperty(name = "保障序号",notes = "")
64 64
     private String guaranteeNo ;
@@ -92,6 +92,9 @@ public class GuaranteeTask implements Serializable,Cloneable{
92 92
     /** 保障标准 */
93 93
     @ApiModelProperty(name = "保障标准",notes = "")
94 94
     private String standard ;
95
+    /** 套餐名称 */
96
+    @ApiModelProperty(name = "套餐名称",notes = "")
97
+    private String packageName ;
95 98
     /** 备注 */
96 99
     @ApiModelProperty(name = "备注",notes = "")
97 100
     private String remark ;