Yansen 2 年 前
コミット
80450456f7

+ 25
- 0
src/main/java/com/yunzhi/inte/controller/GuaranteeDetailController.java ファイルの表示

@@ -7,6 +7,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.yunzhi.inte.common.BaseController;
8 8
 import com.yunzhi.inte.common.ResponseBean;
9 9
 import java.util.List;
10
+
11
+import com.yunzhi.inte.entity.Dishes;
12
+import com.yunzhi.inte.entity.GuaranteeTask;
13
+import com.yunzhi.inte.service.DishesService;
14
+import com.yunzhi.inte.service.GuaranteeTaskService;
10 15
 import io.swagger.annotations.Api;
11 16
 import io.swagger.annotations.ApiOperation;
12 17
 import io.swagger.annotations.ApiParam;
@@ -28,6 +33,12 @@ public class GuaranteeDetailController extends BaseController {
28 33
     @Autowired
29 34
     private GuaranteeDetailService guaranteeDetailService;
30 35
 
36
+    @Autowired
37
+    private DishesService dishesService;
38
+
39
+    @Autowired
40
+    private GuaranteeTaskService guaranteeTaskService;
41
+
31 42
     /**
32 43
      * 通过ID查询单条数据
33 44
      *
@@ -104,8 +115,22 @@ public class GuaranteeDetailController extends BaseController {
104 115
         guaranteeDetailService.remove(queryWrapper);
105 116
 
106 117
         // 再批量插入
118
+        int costs = 0;
107 119
         for (GuaranteeDetail item : list) {
108 120
             item.setGuaranteeId(guaranteeId);
121
+
122
+            Dishes dishes = dishesService.getById(item.getDishId());
123
+            if (null != dishes) {
124
+                Integer price = dishes.getPrice();
125
+                costs += null == price ? 0 : price;
126
+            }
127
+        }
128
+
129
+        // 更新成本
130
+        GuaranteeTask task = guaranteeTaskService.getById(guaranteeId);
131
+        if (null != task) {
132
+            task.setCosts(costs);
133
+            guaranteeTaskService.updateById(task);
109 134
         }
110 135
 
111 136
         guaranteeDetailService.saveBatch(list);

+ 2
- 0
src/main/java/com/yunzhi/inte/controller/PostsController.java ファイルの表示

@@ -70,11 +70,13 @@ public class PostsController extends BaseController {
70 70
     public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
71 71
                              @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
72 72
                              @ApiParam("标题") @RequestParam(value = "title", required = false) String title,
73
+                             @ApiParam("类型") @RequestParam(value = "type", required = false) String type,
73 74
                              @ApiParam("状态") @RequestParam(value = "status", required = false) Integer status) throws Exception {
74 75
 
75 76
         IPage<Posts> pg = new Page<>(pageNum, pageSize);
76 77
         QueryWrapper<Posts> queryWrapper = new QueryWrapper<>();
77 78
         queryWrapper.like(!StringUtils.isEmpty(title), "title", title);
79
+        queryWrapper.eq(!StringUtils.isEmpty(type), "type", type);
78 80
         queryWrapper.eq(null != status, "status", status);
79 81
         queryWrapper.gt("status", Constants.STATUS_DELETE);
80 82
 

+ 3
- 0
src/main/java/com/yunzhi/inte/entity/Dishes.java ファイルの表示

@@ -36,6 +36,9 @@ public class Dishes implements Serializable,Cloneable{
36 36
     @ApiModelProperty(name = "菜肴单位",notes = "")
37 37
     private String unit ;
38 38
     /** 食材数量 */
39
+    @ApiModelProperty(name = "价格",notes = "")
40
+    private Integer price;
41
+    /** 食材数量 */
39 42
     @ApiModelProperty(name = "食材数量",notes = "")
40 43
     private Integer foodNum;
41 44
     /** 状态 */

+ 3
- 0
src/main/java/com/yunzhi/inte/entity/GuaranteeTask.java ファイルの表示

@@ -98,6 +98,9 @@ public class GuaranteeTask implements Serializable,Cloneable{
98 98
     /** 备注 */
99 99
     @ApiModelProperty(name = "备注",notes = "")
100 100
     private String remark ;
101
+    /** 成本 */
102
+    @ApiModelProperty(name = "成本",notes = "")
103
+    private Integer costs ;
101 104
     /** 状态 */
102 105
     @ApiModelProperty(name = "状态",notes = "")
103 106
     private Integer status ;

+ 2
- 0
src/main/java/com/yunzhi/inte/entity/Package.java ファイルの表示

@@ -32,6 +32,8 @@ public class Package implements Serializable,Cloneable{
32 32
     /** 单位 */
33 33
     @ApiModelProperty(name = "单位",notes = "")
34 34
     private String unit ;
35
+    @ApiModelProperty(name = "价格",notes = "")
36
+    private Integer price;
35 37
     /** 状态 */
36 38
     @ApiModelProperty(name = "状态",notes = "")
37 39
     private Integer status ;

+ 5
- 0
src/main/java/com/yunzhi/inte/entity/Posts.java ファイルの表示

@@ -34,6 +34,11 @@ public class Posts implements Serializable, Cloneable {
34 34
     @ApiModelProperty(name = "发布ID", notes = "")
35 35
     @TableId(value = "id", type = IdType.AUTO)
36 36
     private Integer id;
37
+    /**
38
+     * 发布内容
39
+     */
40
+    @ApiModelProperty(name = "内容类型", notes = "")
41
+    private String type;
37 42
     /**
38 43
      * 发布内容
39 44
      */