|
@@ -0,0 +1,158 @@
|
|
1
|
+package com.yunzhi.marketing.borker.controller;
|
|
2
|
+
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
4
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
5
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
6
|
+import com.yunzhi.marketing.base.BaseController;
|
|
7
|
+import com.yunzhi.marketing.base.ResponseBean;
|
|
8
|
+import com.yunzhi.marketing.borker.entity.BkAgentRule;
|
|
9
|
+import com.yunzhi.marketing.borker.entity.BkAgreement;
|
|
10
|
+import com.yunzhi.marketing.borker.service.IBkAgentRuleService;
|
|
11
|
+import com.yunzhi.marketing.borker.service.IBkAgreementService;
|
|
12
|
+import com.yunzhi.marketing.common.CommConstant;
|
|
13
|
+import com.yunzhi.marketing.common.StringUtils;
|
|
14
|
+import io.swagger.annotations.Api;
|
|
15
|
+import io.swagger.annotations.ApiOperation;
|
|
16
|
+import io.swagger.annotations.ApiParam;
|
|
17
|
+import org.slf4j.Logger;
|
|
18
|
+import org.slf4j.LoggerFactory;
|
|
19
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
20
|
+import org.springframework.web.bind.annotation.*;
|
|
21
|
+
|
|
22
|
+import javax.servlet.http.HttpServletRequest;
|
|
23
|
+
|
|
24
|
+/**
|
|
25
|
+ * <p>
|
|
26
|
+ * 经纪人规则 前端控制器
|
|
27
|
+ * </p>
|
|
28
|
+ *
|
|
29
|
+ * @author yansen
|
|
30
|
+ * @since 2022-07-26
|
|
31
|
+ */
|
|
32
|
+
|
|
33
|
+@Api(tags = "经纪人规则")
|
|
34
|
+@RestController
|
|
35
|
+@RequestMapping("/api")
|
|
36
|
+public class BkAgentRuleController extends BaseController {
|
|
37
|
+
|
|
38
|
+ private final Logger logger = LoggerFactory.getLogger(BkAgentRuleController.class);
|
|
39
|
+
|
|
40
|
+ @Autowired
|
|
41
|
+ public IBkAgentRuleService iBkAgentRuleService;
|
|
42
|
+
|
|
43
|
+//
|
|
44
|
+// /**
|
|
45
|
+// * 分页查询列表
|
|
46
|
+// * @param pageNum
|
|
47
|
+// * @param pageSize
|
|
48
|
+// * @return
|
|
49
|
+// */
|
|
50
|
+// @RequestMapping(value="/{client}/bkAgentRule",method= RequestMethod.GET)
|
|
51
|
+// @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
|
|
52
|
+// public ResponseBean bkAgreementList(@ApiParam("客户端") @PathVariable String client,
|
|
53
|
+// @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
54
|
+// @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
55
|
+// @ApiParam("楼盘ID") @RequestParam(value ="buildingId", required = false) String buildingId,
|
|
56
|
+// HttpServletRequest request) throws Exception {
|
|
57
|
+//
|
|
58
|
+// IPage<BkAgreement> pg = new Page<>(pageNum, pageSize);
|
|
59
|
+// QueryWrapper<BkAgreement> queryWrapper = new QueryWrapper<>();
|
|
60
|
+// queryWrapper.eq("org_id", getOrgId(request));
|
|
61
|
+// queryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
|
|
62
|
+// queryWrapper.gt("status", CommConstant.STATUS_DELETE);
|
|
63
|
+// queryWrapper.orderByDesc("create_date");
|
|
64
|
+//
|
|
65
|
+// IPage<BkAgreement> result = iBkAgreementService.page(pg, queryWrapper);
|
|
66
|
+// return ResponseBean.success(result);
|
|
67
|
+// }
|
|
68
|
+//
|
|
69
|
+ /**
|
|
70
|
+ * 保存对象
|
|
71
|
+ * @param bkAgreement 实体对象
|
|
72
|
+ * @return
|
|
73
|
+ */
|
|
74
|
+ @RequestMapping(value="/admin/bkAgentRule",method= RequestMethod.POST)
|
|
75
|
+ @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
|
76
|
+ public ResponseBean bkAgreementAdd(@ApiParam("保存内容") @RequestBody BkAgentRule bkAgentRule,
|
|
77
|
+ HttpServletRequest request) throws Exception {
|
|
78
|
+ bkAgentRule.setOrgId(getOrgId(request));
|
|
79
|
+ if (StringUtils.isEmpty(bkAgentRule.getRuleId())) {
|
|
80
|
+ iBkAgentRuleService.save(bkAgentRule);
|
|
81
|
+ } else {
|
|
82
|
+ iBkAgentRuleService.updateById(bkAgentRule);
|
|
83
|
+ }
|
|
84
|
+ return ResponseBean.success(bkAgentRule);
|
|
85
|
+ }
|
|
86
|
+//
|
|
87
|
+// /**
|
|
88
|
+// * 根据id删除对象
|
|
89
|
+// * @param id 实体ID
|
|
90
|
+// */
|
|
91
|
+// @RequestMapping(value="/admin/bkAgreement/{id}", method= RequestMethod.DELETE)
|
|
92
|
+// @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
|
93
|
+// public ResponseBean bkAgreementDelete(@ApiParam("对象ID") @PathVariable String id,
|
|
94
|
+// HttpServletRequest request) throws Exception{
|
|
95
|
+//
|
|
96
|
+// BkAgreement bkAgreement = iBkAgreementService.getById(id);
|
|
97
|
+// if (null == bkAgreement || CommConstant.STATUS_DELETE.equals(bkAgreement.getStatus())) {
|
|
98
|
+// return ResponseBean.success("success");
|
|
99
|
+// }
|
|
100
|
+//
|
|
101
|
+// if (!bkAgreement.getOrgId().equals(getOrgId(request).toString())) {
|
|
102
|
+// return ResponseBean.error("暂无权限", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
103
|
+// }
|
|
104
|
+//
|
|
105
|
+// if(iBkAgreementService.removeById(id)){
|
|
106
|
+// return ResponseBean.success("success");
|
|
107
|
+// }else {
|
|
108
|
+// return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
109
|
+// }
|
|
110
|
+// }
|
|
111
|
+//
|
|
112
|
+// /**
|
|
113
|
+// * 修改对象
|
|
114
|
+// * @param id 实体ID
|
|
115
|
+// * @param bkAgreement 实体对象
|
|
116
|
+// * @return
|
|
117
|
+// */
|
|
118
|
+// @RequestMapping(value="/admin/bkAgreement/{id}",method= RequestMethod.PUT)
|
|
119
|
+// @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
|
120
|
+// public ResponseBean bkAgreementUpdate(@ApiParam("对象ID") @PathVariable String id,
|
|
121
|
+// @ApiParam("更新内容") @RequestBody BkAgreement bkAgreement,
|
|
122
|
+// HttpServletRequest request) throws Exception {
|
|
123
|
+//
|
|
124
|
+// if (StringUtils.isEmpty(bkAgreement.getBuildingId())) {
|
|
125
|
+// return ResponseBean.error("未绑定楼盘", ResponseBean.ERROR_UNAVAILABLE);
|
|
126
|
+// }
|
|
127
|
+//
|
|
128
|
+// BkAgreement origin = iBkAgreementService.getById(id);
|
|
129
|
+// if (CommConstant.STATUS_DELETE.equals(bkAgreement.getStatus())) {
|
|
130
|
+// return ResponseBean.success("success");
|
|
131
|
+// }
|
|
132
|
+//
|
|
133
|
+// if (!getOrgId(request).toString().equals(bkAgreement.getOrgId())) {
|
|
134
|
+// return ResponseBean.error("暂无权限", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
135
|
+// }
|
|
136
|
+//
|
|
137
|
+// bkAgreement.setOrgId(origin.getOrgId());
|
|
138
|
+// bkAgreement.setStatus(CommConstant.STATUS_NORMAL);
|
|
139
|
+//
|
|
140
|
+// if (iBkAgreementService.updateById(bkAgreement)){
|
|
141
|
+// return ResponseBean.success(iBkAgreementService.getById(id));
|
|
142
|
+// }else {
|
|
143
|
+// return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
144
|
+// }
|
|
145
|
+// }
|
|
146
|
+//
|
|
147
|
+ /**
|
|
148
|
+ * 根据id查询对象
|
|
149
|
+ * @param id 实体ID
|
|
150
|
+ */
|
|
151
|
+ @RequestMapping(value="/{client}/bkAgentRule",method= RequestMethod.GET)
|
|
152
|
+ @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
|
153
|
+ public ResponseBean bkAgreementGet(@ApiParam("发布状态") @RequestParam(value ="status", required = false) Integer status,
|
|
154
|
+ HttpServletRequest request) throws Exception {
|
|
155
|
+ Integer orgId = getOrgId(request);
|
|
156
|
+ return ResponseBean.success(iBkAgentRuleService.getByOrgId(orgId, status));
|
|
157
|
+ }
|
|
158
|
+}
|