张延森 2 yıl önce
ebeveyn
işleme
f3ad9bb3c3

+ 2
- 1
src/main/java/com/yunzhi/marketing/base/BaseController.java Dosyayı Görüntüle

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 5
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
6 6
 import com.yunzhi.marketing.center.taUser.service.ITaUserService;
7
+import com.yunzhi.marketing.common.CommConstant;
7 8
 import com.yunzhi.marketing.common.JWTUtils;
8 9
 import com.yunzhi.marketing.entity.TaBuilding;
9 10
 import com.yunzhi.marketing.entity.TaPersonBuilding;
@@ -132,7 +133,7 @@ public class BaseController {
132 133
         TaUser taUser = taUserService.getById(getUserId(request));
133 134
         List<Institution> list = iInstitutionService.getAllByUser(taUser);
134 135
         List<String> institutions = list.stream().map(Institution::getInstitutionId).collect(Collectors.toList());
135
-        if (institutions.contains("01")) {
136
+        if (institutions.contains(CommConstant.ROOT_INSTITUTION)) {
136 137
             return null;
137 138
         }
138 139
         return institutions;

+ 53
- 18
src/main/java/com/yunzhi/marketing/borker/controller/BkAgreementController.java Dosyayı Görüntüle

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.common.CommConstant;
8 9
 import io.swagger.annotations.Api;
9 10
 import io.swagger.annotations.ApiOperation;
10 11
 import io.swagger.annotations.ApiParam;
@@ -20,6 +21,8 @@ import com.yunzhi.marketing.borker.service.IBkAgreementService;
20 21
 import com.yunzhi.marketing.borker.entity.BkAgreement;
21 22
 import org.springframework.web.bind.annotation.RestController;
22 23
 
24
+import javax.servlet.http.HttpServletRequest;
25
+
23 26
 /**
24 27
  * <p>
25 28
     * 佣金规则 前端控制器
@@ -31,7 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
31 34
 
32 35
 @Api(tags = "佣金规则")
33 36
 @RestController
34
-@RequestMapping("/")
37
+@RequestMapping("/api")
35 38
 public class BkAgreementController extends BaseController {
36 39
 
37 40
     private final Logger logger = LoggerFactory.getLogger(BkAgreementController.class);
@@ -46,17 +49,21 @@ public class BkAgreementController extends BaseController {
46 49
      * @param pageSize
47 50
      * @return
48 51
      */
49
-    @RequestMapping(value="/bkAgreement",method= RequestMethod.GET)
52
+    @RequestMapping(value="/{client}/bkAgreement",method= RequestMethod.GET)
50 53
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean bkAgreementList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
54
+    public ResponseBean bkAgreementList(@ApiParam("客户端") @PathVariable String client,
55
+                                        @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56
+                                        @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
57
+                                        HttpServletRequest request) throws Exception{
53 58
 
54
-		    IPage<BkAgreement> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<BkAgreement> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
59
+        IPage<BkAgreement> pg = new Page<>(pageNum, pageSize);
60
+        QueryWrapper<BkAgreement> queryWrapper = new QueryWrapper<>();
61
+        queryWrapper.eq("org_id", getOrgId(request));
62
+        queryWrapper.gt("status", CommConstant.STATUS_DELETE);
63
+        queryWrapper.orderByDesc("create_date");
57 64
 
58
-            IPage<BkAgreement> result = iBkAgreementService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
65
+        IPage<BkAgreement> result = iBkAgreementService.page(pg, queryWrapper);
66
+        return ResponseBean.success(result);
60 67
     }
61 68
 
62 69
     /**
@@ -64,9 +71,13 @@ public class BkAgreementController extends BaseController {
64 71
      * @param bkAgreement 实体对象
65 72
      * @return
66 73
      */
67
-    @RequestMapping(value="/bkAgreement",method= RequestMethod.POST)
74
+    @RequestMapping(value="/admin/bkAgreement",method= RequestMethod.POST)
68 75
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean bkAgreementAdd(@ApiParam("保存内容") @RequestBody BkAgreement bkAgreement) throws Exception{
76
+    public ResponseBean bkAgreementAdd(@ApiParam("保存内容") @RequestBody BkAgreement bkAgreement,
77
+                                       HttpServletRequest request) throws Exception {
78
+
79
+        bkAgreement.setOrgId(getOrgId(request).toString());
80
+        bkAgreement.setInstitutionId(CommConstant.ROOT_INSTITUTION);
70 81
 
71 82
         if (iBkAgreementService.save(bkAgreement)){
72 83
             return ResponseBean.success(bkAgreement);
@@ -79,9 +90,20 @@ public class BkAgreementController extends BaseController {
79 90
      * 根据id删除对象
80 91
      * @param id  实体ID
81 92
      */
82
-    @RequestMapping(value="/bkAgreement/{id}", method= RequestMethod.DELETE)
93
+    @RequestMapping(value="/admin/bkAgreement/{id}", method= RequestMethod.DELETE)
83 94
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean bkAgreementDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
95
+    public ResponseBean bkAgreementDelete(@ApiParam("对象ID") @PathVariable String id,
96
+                                          HttpServletRequest request) throws Exception{
97
+
98
+        BkAgreement bkAgreement = iBkAgreementService.getById(id);
99
+        if (null == bkAgreement || CommConstant.STATUS_DELETE.equals(bkAgreement)) {
100
+            return ResponseBean.success("success");
101
+        }
102
+
103
+        if (!bkAgreement.getOrgId().equals(getOrgId(request))) {
104
+            return ResponseBean.error("暂无权限", ResponseBean.ERROR_ILLEGAL_PARAMS);
105
+        }
106
+
85 107
         if(iBkAgreementService.removeById(id)){
86 108
             return ResponseBean.success("success");
87 109
         }else {
@@ -95,10 +117,23 @@ public class BkAgreementController extends BaseController {
95 117
      * @param bkAgreement 实体对象
96 118
      * @return
97 119
      */
98
-    @RequestMapping(value="/bkAgreement/{id}",method= RequestMethod.PUT)
120
+    @RequestMapping(value="/admin/bkAgreement/{id}",method= RequestMethod.PUT)
99 121
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean bkAgreementUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody BkAgreement bkAgreement) throws Exception{
122
+    public ResponseBean bkAgreementUpdate(@ApiParam("对象ID") @PathVariable String id,
123
+                                          @ApiParam("更新内容") @RequestBody BkAgreement bkAgreement,
124
+                                          HttpServletRequest request) throws Exception{
125
+
126
+
127
+        BkAgreement origin = iBkAgreementService.getById(id);
128
+        if (null == bkAgreement || CommConstant.STATUS_DELETE.equals(bkAgreement)) {
129
+            return ResponseBean.success("success");
130
+        }
131
+
132
+        if (!bkAgreement.getOrgId().equals(getOrgId(request))) {
133
+            return ResponseBean.error("暂无权限", ResponseBean.ERROR_ILLEGAL_PARAMS);
134
+        }
135
+
136
+        bkAgreement.setOrgId(origin.getOrgId());
102 137
 
103 138
         if (iBkAgreementService.updateById(bkAgreement)){
104 139
             return ResponseBean.success(iBkAgreementService.getById(id));
@@ -111,9 +146,9 @@ public class BkAgreementController extends BaseController {
111 146
      * 根据id查询对象
112 147
      * @param id  实体ID
113 148
      */
114
-    @RequestMapping(value="/bkAgreement/{id}",method= RequestMethod.GET)
149
+    @RequestMapping(value="/{client}/bkAgreement/{id}",method= RequestMethod.GET)
115 150
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean bkAgreementGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
151
+    public ResponseBean bkAgreementGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
117 152
         return ResponseBean.success(iBkAgreementService.getById(id));
118 153
     }
119 154
 }

+ 50
- 17
src/main/java/com/yunzhi/marketing/borker/controller/BkBankCardController.java Dosyayı Görüntüle

@@ -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.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.common.CommConstant;
9
+import com.yunzhi.marketing.entity.TaPerson;
8 10
 import io.swagger.annotations.Api;
9 11
 import io.swagger.annotations.ApiOperation;
10 12
 import io.swagger.annotations.ApiParam;
@@ -20,6 +22,8 @@ import com.yunzhi.marketing.borker.service.IBkBankCardService;
20 22
 import com.yunzhi.marketing.borker.entity.BkBankCard;
21 23
 import org.springframework.web.bind.annotation.RestController;
22 24
 
25
+import javax.servlet.http.HttpServletRequest;
26
+
23 27
 /**
24 28
  * <p>
25 29
     * 经纪人银行卡信息 前端控制器
@@ -31,7 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
31 35
 
32 36
 @Api(tags = "经纪人银行卡信息")
33 37
 @RestController
34
-@RequestMapping("/")
38
+@RequestMapping("/api")
35 39
 public class BkBankCardController extends BaseController {
36 40
 
37 41
     private final Logger logger = LoggerFactory.getLogger(BkBankCardController.class);
@@ -46,17 +50,22 @@ public class BkBankCardController extends BaseController {
46 50
      * @param pageSize
47 51
      * @return
48 52
      */
49
-    @RequestMapping(value="/bkBankCard",method= RequestMethod.GET)
53
+    @RequestMapping(value="/wx/bkBankCard",method= RequestMethod.GET)
50 54
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51 55
     public ResponseBean bkBankCardList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
56
+                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
57
+                                       HttpServletRequest request) throws Exception {
58
+
59
+        String personId = getPersonId(request);
53 60
 
54
-		    IPage<BkBankCard> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<BkBankCard> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
61
+        IPage<BkBankCard> pg = new Page<>(pageNum, pageSize);
62
+        QueryWrapper<BkBankCard> queryWrapper = new QueryWrapper<>();
63
+        queryWrapper.gt("status", CommConstant.STATUS_DELETE);
64
+        queryWrapper.eq("person_id", personId);
65
+        queryWrapper.orderByDesc("create_date");
57 66
 
58
-            IPage<BkBankCard> result = iBkBankCardService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
67
+        IPage<BkBankCard> result = iBkBankCardService.page(pg, queryWrapper);
68
+        return ResponseBean.success(result);
60 69
     }
61 70
 
62 71
     /**
@@ -64,9 +73,12 @@ public class BkBankCardController extends BaseController {
64 73
      * @param bkBankCard 实体对象
65 74
      * @return
66 75
      */
67
-    @RequestMapping(value="/bkBankCard",method= RequestMethod.POST)
76
+    @RequestMapping(value="/wx/bkBankCard",method= RequestMethod.POST)
68 77
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean bkBankCardAdd(@ApiParam("保存内容") @RequestBody BkBankCard bkBankCard) throws Exception{
78
+    public ResponseBean bkBankCardAdd(@ApiParam("保存内容") @RequestBody BkBankCard bkBankCard,
79
+                                      HttpServletRequest request) throws Exception {
80
+        String personId = getPersonId(request);
81
+        bkBankCard.setPersonId(personId);
70 82
 
71 83
         if (iBkBankCardService.save(bkBankCard)){
72 84
             return ResponseBean.success(bkBankCard);
@@ -79,9 +91,16 @@ public class BkBankCardController extends BaseController {
79 91
      * 根据id删除对象
80 92
      * @param id  实体ID
81 93
      */
82
-    @RequestMapping(value="/bkBankCard/{id}", method= RequestMethod.DELETE)
94
+    @RequestMapping(value="/wx/bkBankCard/{id}", method= RequestMethod.DELETE)
83 95
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean bkBankCardDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
96
+    public ResponseBean bkBankCardDelete(@ApiParam("对象ID") @PathVariable Integer id,
97
+                                         HttpServletRequest request) throws Exception {
98
+        String personId = getPersonId(request);
99
+        BkBankCard bkBankCard = iBkBankCardService.getById(id);
100
+        if (null != bkBankCard && !personId.equals(bkBankCard.getPersonId())) {
101
+            return ResponseBean.error("操作异常", ResponseBean.ERROR_ILLEGAL_PARAMS);
102
+        }
103
+
85 104
         if(iBkBankCardService.removeById(id)){
86 105
             return ResponseBean.success("success");
87 106
         }else {
@@ -95,10 +114,18 @@ public class BkBankCardController extends BaseController {
95 114
      * @param bkBankCard 实体对象
96 115
      * @return
97 116
      */
98
-    @RequestMapping(value="/bkBankCard/{id}",method= RequestMethod.PUT)
117
+    @RequestMapping(value="/wx/bkBankCard/{id}",method= RequestMethod.PUT)
99 118
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100 119
     public ResponseBean bkBankCardUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody BkBankCard bkBankCard) throws Exception{
120
+                                         @ApiParam("更新内容") @RequestBody BkBankCard bkBankCard,
121
+                                         HttpServletRequest request) throws Exception {
122
+        String personId = getPersonId(request);
123
+        BkBankCard origin = iBkBankCardService.getById(id);
124
+        if (null == origin || CommConstant.STATUS_DELETE.equals(origin.getStatus()) || !personId.equals(origin.getPersonId())) {
125
+            return ResponseBean.error("未找到数据", ResponseBean.ERROR_ILLEGAL_PARAMS);
126
+        }
127
+
128
+        bkBankCard.setPersonId(personId);
102 129
 
103 130
         if (iBkBankCardService.updateById(bkBankCard)){
104 131
             return ResponseBean.success(iBkBankCardService.getById(id));
@@ -111,9 +138,15 @@ public class BkBankCardController extends BaseController {
111 138
      * 根据id查询对象
112 139
      * @param id  实体ID
113 140
      */
114
-    @RequestMapping(value="/bkBankCard/{id}",method= RequestMethod.GET)
141
+    @RequestMapping(value="/wx/bkBankCard/{id}",method= RequestMethod.GET)
115 142
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean bkBankCardGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iBkBankCardService.getById(id));
143
+    public ResponseBean bkBankCardGet(@ApiParam("对象ID") @PathVariable Integer id,
144
+                                      HttpServletRequest request) throws Exception{
145
+        String personId = getPersonId(request);
146
+        BkBankCard origin = iBkBankCardService.getById(id);
147
+        if (null == origin || CommConstant.STATUS_DELETE.equals(origin.getStatus()) || !personId.equals(origin.getPersonId())) {
148
+            return ResponseBean.error("未找到数据", ResponseBean.ERROR_ILLEGAL_PARAMS);
149
+        }
150
+        return ResponseBean.success(origin);
118 151
     }
119 152
 }

+ 35
- 16
src/main/java/com/yunzhi/marketing/borker/controller/BkFirstScreenController.java Dosyayı Görüntüle

@@ -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.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.common.CommConstant;
9
+import com.yunzhi.marketing.common.StringUtils;
8 10
 import io.swagger.annotations.Api;
9 11
 import io.swagger.annotations.ApiOperation;
10 12
 import io.swagger.annotations.ApiParam;
@@ -20,6 +22,9 @@ import com.yunzhi.marketing.borker.service.IBkFirstScreenService;
20 22
 import com.yunzhi.marketing.borker.entity.BkFirstScreen;
21 23
 import org.springframework.web.bind.annotation.RestController;
22 24
 
25
+import javax.servlet.http.HttpServletRequest;
26
+import java.util.List;
27
+
23 28
 /**
24 29
  * <p>
25 30
     * 经纪人首屏广告 前端控制器
@@ -31,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
31 36
 
32 37
 @Api(tags = "经纪人首屏广告")
33 38
 @RestController
34
-@RequestMapping("/")
39
+@RequestMapping("/api")
35 40
 public class BkFirstScreenController extends BaseController {
36 41
 
37 42
     private final Logger logger = LoggerFactory.getLogger(BkFirstScreenController.class);
@@ -46,17 +51,27 @@ public class BkFirstScreenController extends BaseController {
46 51
      * @param pageSize
47 52
      * @return
48 53
      */
49
-    @RequestMapping(value="/bkFirstScreen",method= RequestMethod.GET)
54
+    @RequestMapping(value="/{client}/bkFirstScreen",method= RequestMethod.GET)
50 55
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean bkFirstScreenList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
56
+    public ResponseBean bkFirstScreenList(@ApiParam("客户端") @PathVariable String client,
57
+                                          @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
58
+                                          @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
59
+                                          HttpServletRequest request) throws Exception{
60
+
61
+        IPage<BkFirstScreen> pg = new Page<>(pageNum, pageSize);
62
+        QueryWrapper<BkFirstScreen> queryWrapper = new QueryWrapper<>();
63
+        queryWrapper.gt("status", CommConstant.STATUS_DELETE);
64
+        queryWrapper.eq("org_id", getOrgId(request));
53 65
 
54
-		    IPage<BkFirstScreen> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<BkFirstScreen> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
66
+        if ("admin".equals(client)) {
67
+            List<String> institutionIds = getInstitutionIds(request);
68
+            queryWrapper.in(null != institutionIds, "institution_id", institutionIds);
69
+        }
57 70
 
58
-            IPage<BkFirstScreen> result = iBkFirstScreenService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
71
+        queryWrapper.orderByDesc("create_date");
72
+
73
+        IPage<BkFirstScreen> result = iBkFirstScreenService.page(pg, queryWrapper);
74
+        return ResponseBean.success(result);
60 75
     }
61 76
 
62 77
     /**
@@ -64,9 +79,13 @@ public class BkFirstScreenController extends BaseController {
64 79
      * @param bkFirstScreen 实体对象
65 80
      * @return
66 81
      */
67
-    @RequestMapping(value="/bkFirstScreen",method= RequestMethod.POST)
82
+    @RequestMapping(value="/admin/bkFirstScreen",method= RequestMethod.POST)
68 83
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean bkFirstScreenAdd(@ApiParam("保存内容") @RequestBody BkFirstScreen bkFirstScreen) throws Exception{
84
+    public ResponseBean bkFirstScreenAdd(@ApiParam("保存内容") @RequestBody BkFirstScreen bkFirstScreen,
85
+                                         HttpServletRequest request) throws Exception{
86
+
87
+        bkFirstScreen.setInstitutionId(CommConstant.ROOT_INSTITUTION);
88
+        bkFirstScreen.setOrgId(getOrgId(request).toString());
70 89
 
71 90
         if (iBkFirstScreenService.save(bkFirstScreen)){
72 91
             return ResponseBean.success(bkFirstScreen);
@@ -79,9 +98,9 @@ public class BkFirstScreenController extends BaseController {
79 98
      * 根据id删除对象
80 99
      * @param id  实体ID
81 100
      */
82
-    @RequestMapping(value="/bkFirstScreen/{id}", method= RequestMethod.DELETE)
101
+    @RequestMapping(value="/admin/bkFirstScreen/{id}", method= RequestMethod.DELETE)
83 102
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean bkFirstScreenDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
103
+    public ResponseBean bkFirstScreenDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
85 104
         if(iBkFirstScreenService.removeById(id)){
86 105
             return ResponseBean.success("success");
87 106
         }else {
@@ -95,7 +114,7 @@ public class BkFirstScreenController extends BaseController {
95 114
      * @param bkFirstScreen 实体对象
96 115
      * @return
97 116
      */
98
-    @RequestMapping(value="/bkFirstScreen/{id}",method= RequestMethod.PUT)
117
+    @RequestMapping(value="/admin/bkFirstScreen/{id}",method= RequestMethod.PUT)
99 118
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100 119
     public ResponseBean bkFirstScreenUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101 120
                                         @ApiParam("更新内容") @RequestBody BkFirstScreen bkFirstScreen) throws Exception{
@@ -111,9 +130,9 @@ public class BkFirstScreenController extends BaseController {
111 130
      * 根据id查询对象
112 131
      * @param id  实体ID
113 132
      */
114
-    @RequestMapping(value="/bkFirstScreen/{id}",method= RequestMethod.GET)
133
+    @RequestMapping(value="/admin/bkFirstScreen/{id}",method= RequestMethod.GET)
115 134
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean bkFirstScreenGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
135
+    public ResponseBean bkFirstScreenGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
117 136
         return ResponseBean.success(iBkFirstScreenService.getById(id));
118 137
     }
119 138
 }

+ 76
- 57
src/main/java/com/yunzhi/marketing/borker/controller/BkNoticeController.java Dosyayı Görüntüle

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.common.CommConstant;
8 9
 import io.swagger.annotations.Api;
9 10
 import io.swagger.annotations.ApiOperation;
10 11
 import io.swagger.annotations.ApiParam;
@@ -20,6 +21,9 @@ import com.yunzhi.marketing.borker.service.IBkNoticeService;
20 21
 import com.yunzhi.marketing.borker.entity.BkNotice;
21 22
 import org.springframework.web.bind.annotation.RestController;
22 23
 
24
+import javax.servlet.http.HttpServletRequest;
25
+import java.util.List;
26
+
23 27
 /**
24 28
  * <p>
25 29
     * 通知公告 前端控制器
@@ -31,7 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
31 35
 
32 36
 @Api(tags = "通知公告")
33 37
 @RestController
34
-@RequestMapping("/")
38
+@RequestMapping("/api")
35 39
 public class BkNoticeController extends BaseController {
36 40
 
37 41
     private final Logger logger = LoggerFactory.getLogger(BkNoticeController.class);
@@ -46,74 +50,89 @@ public class BkNoticeController extends BaseController {
46 50
      * @param pageSize
47 51
      * @return
48 52
      */
49
-    @RequestMapping(value="/bkNotice",method= RequestMethod.GET)
53
+    @RequestMapping(value="/{client}/bkNotice",method= RequestMethod.GET)
50 54
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean bkNoticeList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
-
54
-		    IPage<BkNotice> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<BkNotice> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
55
+    public ResponseBean bkNoticeList(@ApiParam("客户端") @PathVariable String client,
56
+                                     @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
57
+                                     @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
58
+                                     HttpServletRequest request) throws Exception{
57 59
 
58
-            IPage<BkNotice> result = iBkNoticeService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
-    }
60
+        IPage<BkNotice> pg = new Page<>(pageNum, pageSize);
61
+        QueryWrapper<BkNotice> queryWrapper = new QueryWrapper<>();
62
+        queryWrapper.gt("status", CommConstant.STATUS_DELETE);
61 63
 
62
-    /**
63
-     * 保存对象
64
-     * @param bkNotice 实体对象
65
-     * @return
66
-     */
67
-    @RequestMapping(value="/bkNotice",method= RequestMethod.POST)
68
-    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean bkNoticeAdd(@ApiParam("保存内容") @RequestBody BkNotice bkNotice) throws Exception{
70
-
71
-        if (iBkNoticeService.save(bkNotice)){
72
-            return ResponseBean.success(bkNotice);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
-        }
76
-    }
77
-
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/bkNotice/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean bkNoticeDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iBkNoticeService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
64
+        if ("admin".equals(client)) {
65
+            List<String> institutionIds = getInstitutionIds(request);
66
+            queryWrapper.in(null != institutionIds, "institution_id", institutionIds);
89 67
         }
90
-    }
91 68
 
92
-    /**
93
-     * 修改对象
94
-     * @param id  实体ID
95
-     * @param bkNotice 实体对象
96
-     * @return
97
-     */
98
-    @RequestMapping(value="/bkNotice/{id}",method= RequestMethod.PUT)
99
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean bkNoticeUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody BkNotice bkNotice) throws Exception{
69
+        queryWrapper.orderByDesc("create_date");
102 70
 
103
-        if (iBkNoticeService.updateById(bkNotice)){
104
-            return ResponseBean.success(iBkNoticeService.getById(id));
105
-        }else {
106
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
-        }
71
+        IPage<BkNotice> result = iBkNoticeService.page(pg, queryWrapper);
72
+        return ResponseBean.success(result);
108 73
     }
109 74
 
75
+//    /**
76
+//     * 保存对象
77
+//     * @param bkNotice 实体对象
78
+//     * @return
79
+//     */
80
+//    @RequestMapping(value="/bkNotice",method= RequestMethod.POST)
81
+//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
82
+//    public ResponseBean bkNoticeAdd(@ApiParam("保存内容") @RequestBody BkNotice bkNotice) throws Exception{
83
+//
84
+//        if (iBkNoticeService.save(bkNotice)){
85
+//            return ResponseBean.success(bkNotice);
86
+//        }else {
87
+//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
88
+//        }
89
+//    }
90
+//
91
+//    /**
92
+//     * 根据id删除对象
93
+//     * @param id  实体ID
94
+//     */
95
+//    @RequestMapping(value="/bkNotice/{id}", method= RequestMethod.DELETE)
96
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
97
+//    public ResponseBean bkNoticeDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
98
+//        if(iBkNoticeService.removeById(id)){
99
+//            return ResponseBean.success("success");
100
+//        }else {
101
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
102
+//        }
103
+//    }
104
+//
105
+//    /**
106
+//     * 修改对象
107
+//     * @param id  实体ID
108
+//     * @param bkNotice 实体对象
109
+//     * @return
110
+//     */
111
+//    @RequestMapping(value="/bkNotice/{id}",method= RequestMethod.PUT)
112
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
113
+//    public ResponseBean bkNoticeUpdate(@ApiParam("对象ID") @PathVariable Integer id,
114
+//                                        @ApiParam("更新内容") @RequestBody BkNotice bkNotice) throws Exception{
115
+//
116
+//        if (iBkNoticeService.updateById(bkNotice)){
117
+//            return ResponseBean.success(iBkNoticeService.getById(id));
118
+//        }else {
119
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
120
+//        }
121
+//    }
122
+
110 123
     /**
111 124
      * 根据id查询对象
112 125
      * @param id  实体ID
113 126
      */
114
-    @RequestMapping(value="/bkNotice/{id}",method= RequestMethod.GET)
127
+    @RequestMapping(value="/{client}/bkNotice/{id}",method= RequestMethod.GET)
115 128
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean bkNoticeGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iBkNoticeService.getById(id));
129
+    public ResponseBean bkNoticeGet(@ApiParam("客户端") @PathVariable String client,
130
+                                    @ApiParam("对象ID") @PathVariable Integer id) throws Exception {
131
+        BkNotice bkNotice = iBkNoticeService.getById(id);
132
+        if (null == bkNotice || CommConstant.STATUS_DELETE.equals(bkNotice.getStatus())) {
133
+            return ResponseBean.error("未找到数据", ResponseBean.ERROR_ILLEGAL_PARAMS);
134
+        }
135
+
136
+        return ResponseBean.success(bkNotice);
118 137
     }
119 138
 }

+ 1
- 1
src/main/java/com/yunzhi/marketing/borker/entity/BkAgreement.java Dosyayı Görüntüle

@@ -27,7 +27,7 @@ public class BkAgreement implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "规则ID")
30
-    @TableId(value = "rule_id", type = IdType.INPUT)
30
+    @TableId(value = "rule_id", type = IdType.UUID)
31 31
     private String ruleId;
32 32
 
33 33
     @ApiModelProperty(value = "规则内容")

+ 1
- 1
src/main/java/com/yunzhi/marketing/borker/entity/BkFirstScreen.java Dosyayı Görüntüle

@@ -27,7 +27,7 @@ public class BkFirstScreen implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "ID")
30
-    @TableId(value = "screen_id", type = IdType.INPUT)
30
+    @TableId(value = "screen_id", type = IdType.UUID)
31 31
     private String screenId;
32 32
 
33 33
     @ApiModelProperty(value = "显示类型")

+ 6
- 0
src/main/java/com/yunzhi/marketing/common/CommConstant.java Dosyayı Görüntüle

@@ -954,4 +954,10 @@ public class CommConstant {
954 954
      */
955 955
     public static final String CHANNEL_CUSTOMER_AGREE = "2";
956 956
     public static final String CHANNEL_CUSTOMER_DISAGREE = "3";
957
+
958
+    /**
959
+     * 根机构ID
960
+     */
961
+    public static final String ROOT_INSTITUTION = "01";
957 962
 }
963
+

+ 1
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Dosyayı Görüntüle

@@ -703,7 +703,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
703 703
     public String getInstitutionId(String buildingId) {
704 704
         TaBuilding building = taBuildingMapper.selectById(buildingId);
705 705
         if (null == building){
706
-            return "01";
706
+            return CommConstant.ROOT_INSTITUTION;
707 707
         }
708 708
         return building.getInstitutionId();
709 709
     }