傅行帆 6 anni fa
parent
commit
9188ad6d68

+ 7
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Vedi File

@@ -117,4 +117,11 @@ public class Constant {
117 117
      * 报名状态 未报名
118 118
      */
119 119
     public static final String STATUS_UNSIGN = "unsigned";
120
+    
121
+    /**
122
+     * 运营端修改管理员已存在
123
+     */
124
+	public static final String ADMIN_IS_EXIST = "管理员账号已存在";
125
+	
126
+    public static final String SUCCESS = "success";
120 127
 }

+ 8
- 2
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/CommunityController.java Vedi File

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.controller;
2 2
 
3
+import com.community.commom.constant.Constant;
3 4
 import com.community.commom.mode.ResponseBean;
4 5
 import com.community.huiju.model.ToCommunities;
5 6
 import com.community.huiju.service.CommunityServiceI;
@@ -95,8 +96,13 @@ public class CommunityController {
95 96
 	@RequestMapping(value = "/community/update",method = RequestMethod.POST)
96 97
 	public ResponseBean updateCommunityById(@RequestBody ToCommunities toCommunities){
97 98
 		ResponseBean responseBean = new ResponseBean();
98
-		Integer size = communityService.updateCommunityById(toCommunities);
99
-		responseBean.addSuccess(size);
99
+		String message = communityService.updateCommunityById(toCommunities);
100
+		if (message.equals(Constant.SUCCESS)){
101
+			responseBean.addSuccess(message);
102
+		}else {
103
+			responseBean.addError(message);
104
+		}
105
+		
100 106
 		return responseBean;
101 107
 	}
102 108
 }

+ 5
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TpUserMapper.java Vedi File

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpUser;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 @Mapper
7 8
 public interface TpUserMapper {
@@ -16,4 +17,8 @@ public interface TpUserMapper {
16 17
     int updateByPrimaryKeySelective(TpUser record);
17 18
 
18 19
     int updateByPrimaryKey(TpUser record);
20
+    
21
+    TpUser selectByTel(@Param("id") Integer id,@Param("loginName") String loginName);
22
+    
23
+    int updateByTel(@Param("id") Integer id,@Param("loginName") String loginName,@Param("userName") String userName,@Param("oldTel") String oldTel);
19 24
 }

+ 1
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/CommunityServiceI.java Vedi File

@@ -35,5 +35,5 @@ public interface CommunityServiceI {
35 35
 	 * @param toCommunities
36 36
 	 * @return
37 37
 	 */
38
-	Integer updateCommunityById(ToCommunities toCommunities);
38
+	String updateCommunityById(ToCommunities toCommunities);
39 39
 }

+ 12
- 2
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java Vedi File

@@ -96,7 +96,17 @@ public class CommunityServiceImpl implements CommunityServiceI {
96 96
 	 * @return
97 97
 	 */
98 98
 	@Override
99
-	public Integer updateCommunityById(ToCommunities toCommunities) {
100
-		return toCommunitiesMapper.updateByPrimaryKeySelective(toCommunities);
99
+	public String updateCommunityById(ToCommunities toCommunities) {
100
+		ToCommunities oldCommunities = toCommunitiesMapper.selectByPrimaryKey(toCommunities.getId());
101
+		//未修改前的电话号码
102
+		String oldTel = oldCommunities.getLoginName();
103
+		//判断电话号码是否重复
104
+		TpUser tpUser = tpUserMapper.selectByTel(toCommunities.getId(),toCommunities.getLoginName());
105
+		if (null != tpUser && !tpUser.getLoginName().equals(oldTel)){
106
+			return Constant.ADMIN_IS_EXIST;
107
+		}
108
+		tpUserMapper.updateByTel(toCommunities.getId(),toCommunities.getLoginName(),toCommunities.getUserName(),oldTel);
109
+		toCommunitiesMapper.updateByPrimaryKeySelective(toCommunities);
110
+		return Constant.SUCCESS;
101 111
 	}
102 112
 }

+ 6
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToCommunitiesMapper.xml Vedi File

@@ -130,6 +130,12 @@
130 130
       <if test="latitude != null" >
131 131
         latitude = #{latitude,jdbcType=VARCHAR},
132 132
       </if>
133
+      <if test="userName != null" >
134
+        user_name = #{userName,jdbcType=VARCHAR},
135
+      </if>
136
+      <if test="loginName != null" >
137
+        login_name = #{loginName,jdbcType=VARCHAR},
138
+      </if>
133 139
     </set>
134 140
     where id = #{id,jdbcType=INTEGER}
135 141
   </update>

+ 22
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/TpUserMapper.xml Vedi File

@@ -185,4 +185,26 @@
185 185
       update_date = #{updateDate,jdbcType=TIMESTAMP}
186 186
     where id = #{id,jdbcType=INTEGER}
187 187
   </update>
188
+
189
+  <select id="selectByTel" resultMap="BaseResultMap">
190
+      select <include refid="Base_Column_List" /> from tp_user
191
+      where community_id = #{id,jdbcType=INTEGER}
192
+      and login_name = #{loginName,jdbcType=VARCHAR}
193
+      and status = 1
194
+  </select>
195
+
196
+  <update id="updateByTel">
197
+    update tp_user
198
+    <set>
199
+      <if test="userName != null" >
200
+        user_name = #{userName,jdbcType=VARCHAR},
201
+      </if>
202
+      <if test="loginName != null" >
203
+        login_name = #{loginName,jdbcType=VARCHAR},
204
+      </if>
205
+    </set>
206
+    where community_id = #{id,jdbcType=INTEGER}
207
+    and login_name = #{oldTel,jdbcType=VARCHAR}
208
+    and status = 1
209
+  </update>
188 210
 </mapper>

+ 1
- 1
VUECODE/smart-operate-manage/src/store/modules/community.js Vedi File

@@ -92,7 +92,7 @@ const community = {
92 92
     UpdateCommunity({ commit }, datail) {
93 93
       return new Promise((resolve, reject) => {
94 94
         updateCommunity(datail).then(response => {
95
-          resolve()
95
+          resolve(response)
96 96
         }).catch(error => {
97 97
           reject(error)
98 98
         })

+ 10
- 8
VUECODE/smart-operate-manage/src/views/community/communityTable.vue Vedi File

@@ -423,15 +423,17 @@ export default {
423 423
     updateData() {
424 424
       this.$refs['dataForm'].validate((valid) => {
425 425
         if (valid) {
426
-          this.UpdateCommunity(this.detail).then(() => {
426
+          this.UpdateCommunity(this.detail).then((res) => {
427 427
             this.dialogFormVisible = false
428
-            this.$notify({
429
-              title: '成功',
430
-              message: '更新成功',
431
-              type: 'success',
432
-              duration: 2000
433
-            })
434
-            this.getList()
428
+            if (res.code == 0) {
429
+              this.$message({
430
+                message: '更新成功',
431
+                type: 'success'
432
+              })
433
+              this.getList()
434
+            }else if (res.code == 0) {
435
+              this.$message.error(res.message)
436
+            }
435 437
           })
436 438
         }
437 439
       })