魏超 5 anos atrás
pai
commit
40534341cd

+ 5
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java Ver arquivo

104
      */
104
      */
105
     public final static String POINTS_CHANGE_GROUP = "group";
105
     public final static String POINTS_CHANGE_GROUP = "group";
106
 
106
 
107
+    /**
108
+     * 拼团
109
+     */
110
+    public final static String POINTS_CHANGE_HELP = "help";
111
+
107
     /**
112
     /**
108
      * 推荐客户
113
      * 推荐客户
109
      */
114
      */

+ 23
- 4
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java Ver arquivo

9
 import com.huiju.estateagents.common.CommConstant;
9
 import com.huiju.estateagents.common.CommConstant;
10
 import com.huiju.estateagents.common.MD5Utils;
10
 import com.huiju.estateagents.common.MD5Utils;
11
 import com.huiju.estateagents.entity.*;
11
 import com.huiju.estateagents.entity.*;
12
-import com.huiju.estateagents.service.IExtendContentService;
13
-import com.huiju.estateagents.service.ITaBuildingDynamicService;
14
-import com.huiju.estateagents.service.ITaBuildingService;
15
-import com.huiju.estateagents.service.ITdCityService;
12
+import com.huiju.estateagents.service.*;
13
+import com.huiju.estateagents.service.impl.HelpActivityServiceImpl;
16
 import io.jsonwebtoken.lang.Collections;
14
 import io.jsonwebtoken.lang.Collections;
17
 import io.swagger.annotations.Api;
15
 import io.swagger.annotations.Api;
18
 import io.swagger.annotations.ApiImplicitParam;
16
 import io.swagger.annotations.ApiImplicitParam;
19
 import io.swagger.annotations.ApiImplicitParams;
17
 import io.swagger.annotations.ApiImplicitParams;
20
 import io.swagger.annotations.ApiOperation;
18
 import io.swagger.annotations.ApiOperation;
19
+import jodd.util.StringUtil;
21
 import org.apache.commons.lang3.StringUtils;
20
 import org.apache.commons.lang3.StringUtils;
22
 import org.slf4j.Logger;
21
 import org.slf4j.Logger;
23
 import org.slf4j.LoggerFactory;
22
 import org.slf4j.LoggerFactory;
62
     @Autowired
61
     @Autowired
63
     private ITdCityService iTdCityService;
62
     private ITdCityService iTdCityService;
64
 
63
 
64
+    @Autowired
65
+    private ITaNewsService iTaNewsService;
66
+
67
+    @Autowired
68
+    private ITaShareActivityService iTaShareActivityService;
69
+
70
+    @Autowired
71
+    private HelpActivityServiceImpl helpActivityService;
72
+
65
     /**
73
     /**
66
      * 分页查询列表
74
      * 分页查询列表
67
      * @param pageNum
75
      * @param pageNum
219
             }
227
             }
220
             extendContent.setOrgId(getOrgId(request));
228
             extendContent.setOrgId(getOrgId(request));
221
 
229
 
230
+            iExtendContentService.judgleRelationBuildAndActivity(extendContent);
231
+
232
+            if (extendContent.getStatus() == 1){
233
+                boolean publishFlag = iExtendContentService.judgleRelationBuildAndActivity(extendContent);
234
+                if (!publishFlag){
235
+                    responseBean.addError("关联的项目或者活动已取消发布,上架失败");
236
+                    return responseBean;
237
+                }
238
+            }
239
+
240
+            //一个城市只能有一个开屏广告
222
             if (extendContent.getStatus() == 1 && CommConstant.OPEN_SCREEN.equals(extendContent.getShowType())){
241
             if (extendContent.getStatus() == 1 && CommConstant.OPEN_SCREEN.equals(extendContent.getShowType())){
223
                 QueryWrapper<ExtendContent> taExtendContentQueryWrapper = new QueryWrapper<>();
242
                 QueryWrapper<ExtendContent> taExtendContentQueryWrapper = new QueryWrapper<>();
224
                 taExtendContentQueryWrapper.eq("city_id", extendContent.getCityId());
243
                 taExtendContentQueryWrapper.eq("city_id", extendContent.getCityId());

+ 2
- 0
src/main/java/com/huiju/estateagents/service/IExtendContentService.java Ver arquivo

45
      * @param type
45
      * @param type
46
      */
46
      */
47
     void updateActivity(String dynamicId, String type,Integer orgId);
47
     void updateActivity(String dynamicId, String type,Integer orgId);
48
+
49
+    boolean judgleRelationBuildAndActivity(ExtendContent extendContent);
48
 }
50
 }

+ 67
- 2
src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java Ver arquivo

4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.base.ResponseBean;
6
 import com.huiju.estateagents.common.CommConstant;
6
 import com.huiju.estateagents.common.CommConstant;
7
-import com.huiju.estateagents.entity.ExtendContent;
8
-import com.huiju.estateagents.mapper.ExtendContentMapper;
7
+import com.huiju.estateagents.entity.*;
8
+import com.huiju.estateagents.mapper.*;
9
 import com.huiju.estateagents.service.IExtendContentService;
9
 import com.huiju.estateagents.service.IExtendContentService;
10
 import org.apache.commons.lang3.StringUtils;
10
 import org.apache.commons.lang3.StringUtils;
11
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.beans.factory.annotation.Autowired;
26
 
26
 
27
     @Autowired
27
     @Autowired
28
     private ExtendContentMapper extendContentMapper;
28
     private ExtendContentMapper extendContentMapper;
29
+    @Autowired
30
+    private TaBuildingMapper taBuildingMapper;
31
+    @Autowired
32
+    private TaBuildingDynamicMapper taBuildingDynamicMapper;
33
+    @Autowired
34
+    private TaNewsMapper taNewsMapper;
35
+    @Autowired
36
+    private HelpActivityMapper helpActivityMapper;
37
+    @Autowired
38
+    private TaShareActivityMapper taShareActivityMapper;
39
+
29
     @Override
40
     @Override
30
     public ResponseBean extendContentAdd(ExtendContent extendContent) {
41
     public ResponseBean extendContentAdd(ExtendContent extendContent) {
31
         ResponseBean responseBean= new ResponseBean<>();
42
         ResponseBean responseBean= new ResponseBean<>();
87
             extendContentMapper.updateById(extendContent);
98
             extendContentMapper.updateById(extendContent);
88
         }
99
         }
89
     }
100
     }
101
+
102
+    @Override
103
+    public boolean judgleRelationBuildAndActivity(ExtendContent extendContent) {
104
+        //判断已关联的项目或者活动是否取消发布
105
+        if (StringUtils.isNotEmpty(extendContent.getBuildingId())){
106
+            QueryWrapper<TaBuilding> taBuildingQueryWrapper = new QueryWrapper<>();
107
+            taBuildingQueryWrapper.eq("building_id", extendContent.getBuildingId());
108
+            TaBuilding taBuilding = taBuildingMapper.selectOne(taBuildingQueryWrapper);
109
+            if (taBuilding.getStatus() == 0){
110
+                return false;
111
+            }
112
+        }
113
+
114
+        if (CommConstant.CAROUSEL_ACTIVITY.equals(extendContent.getContentType())
115
+                && StringUtils.isNotEmpty(extendContent.getTargetId())){
116
+            QueryWrapper<TaBuildingDynamic> taBuildingDynamicQueryWrapper = new QueryWrapper<>();
117
+            taBuildingDynamicQueryWrapper.eq("dynamic_id", extendContent.getTargetId());
118
+            TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectOne(taBuildingDynamicQueryWrapper);
119
+            if (taBuildingDynamic.getStatus() == 0){
120
+                return false;
121
+            }
122
+        }
123
+
124
+        if (CommConstant.CAROUSEL_NEWS.equals(extendContent.getContentType())
125
+                && StringUtils.isNotEmpty(extendContent.getTargetId())){
126
+            QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
127
+            taNewsQueryWrapper.eq("news_id", extendContent.getTargetId());
128
+            TaNews taNews = taNewsMapper.selectOne(taNewsQueryWrapper);
129
+            if (taNews.getNewsStatus() == 1){
130
+                return false;
131
+            }
132
+        }
133
+
134
+        if (CommConstant.POINTS_CHANGE_HELP.equals(extendContent.getContentType())
135
+                && StringUtils.isNotEmpty(extendContent.getTargetId())){
136
+            QueryWrapper<HelpActivity> helpActivityQueryWrapper = new QueryWrapper<>();
137
+            helpActivityQueryWrapper.eq("help_activity_id", extendContent.getTargetId());
138
+            HelpActivity helpActivity = helpActivityMapper.selectOne(helpActivityQueryWrapper);
139
+            if (helpActivity.getStatus() == -1){
140
+                return false;
141
+            }
142
+        }
143
+
144
+        if (CommConstant.POINTS_CHANGE_GROUP.equals(extendContent.getContentType())
145
+                && StringUtils.isNotEmpty(extendContent.getTargetId())){
146
+            QueryWrapper<TaShareActivity> taShareActivityQueryWrapper = new QueryWrapper<>();
147
+            taShareActivityQueryWrapper.eq("group_activity_id", extendContent.getTargetId());
148
+            TaShareActivity taShareActivity = taShareActivityMapper.selectOne(taShareActivityQueryWrapper);
149
+            if (taShareActivity.getStatus() == -1){
150
+                return false;
151
+            }
152
+        }
153
+        return true;
154
+    }
90
 }
155
 }