weiximei 6 yıl önce
ebeveyn
işleme
dc34b8f853

+ 15
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Dosyayı Görüntüle

@@ -173,4 +173,19 @@ public class Constant {
173 173
      */
174 174
     public static final String SUFFIX_2003 = ".xls";
175 175
     public static final String SUFFIX_2007 = ".xlsx";
176
+    
177
+    /**
178
+     * 成功
179
+     */
180
+    public static final String RESPONSE_SUCCESS = "0";
181
+    
182
+    /**
183
+     * 未认证
184
+     */
185
+	public static final String UN_VERIFY_STATUS = "0";
186
+    
187
+    /**
188
+     * 已认证
189
+     */
190
+    public static final String VERIFY_STATUS = "1";
176 191
 }

+ 9
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java Dosyayı Görüntüle

@@ -132,6 +132,15 @@ public class BuildingOwnerInfoController extends BaseController {
132 132
         responseBean = iBuildingOwnerInfoService.getExcelData(file);
133 133
         return responseBean;
134 134
     }
135
+ 
136
+    @ApiOperation(value = "上传楼栋信息并入库", notes = "上传楼栋信息并入库")
137
+    @PostMapping(value = "/building/submitExcel", consumes = "multipart/*", headers = "content-type=multipart/form-data")
138
+    public ResponseBean submitExcel(@RequestParam("file") MultipartFile file, HttpSession session) {
139
+        ResponseBean responseBean = new ResponseBean();
140
+        UserElement userElement = getUserElement(session);
141
+        responseBean = iBuildingOwnerInfoService.submitExcelData(file,userElement);
142
+        return responseBean;
143
+    }
135 144
 
136 145
     @ApiOperation(value = "获取已认证通过的用户信息",nickname ="获取已认证通过的用户信息")
137 146
     @ApiImplicitParams({
@@ -142,5 +151,4 @@ public class BuildingOwnerInfoController extends BaseController {
142 151
         ResponseBean allApprove=iBuildingOwnerInfoService.selectUserApprove(paramets);
143 152
         return allApprove;
144 153
     }
145
-
146 154
 }

+ 36
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java Dosyayı Görüntüle

@@ -1,13 +1,48 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
6
+
5 7
 import com.community.huiju.model.TaUser;
6 8
 import org.apache.ibatis.annotations.Mapper;
7 9
 import org.apache.ibatis.annotations.Param;
8 10
 
9 11
 import java.util.List;
12
+import java.util.Map;
10 13
 
11 14
 @Mapper
15
+
12 16
 public interface TaUserMapper extends BaseMapper<TaUser> {
17
+    int deleteByPrimaryKey(Integer id);
18
+    
19
+    @Override
20
+    int insert(TaUser record);
21
+
22
+    int insertSelective(TaUser record);
23
+
24
+    TaUser selectByPrimaryKey(Integer id);
25
+
26
+    int updateByPrimaryKeySelective(TaUser record);
27
+
28
+    int updateByPrimaryKey(TaUser record);
29
+
30
+    /**
31
+     * 获取已认证通过的
32
+     * @param map
33
+     * @param page
34
+     * @return
35
+     */
36
+    List<Map<Object,Object>> selectUserApprove(Map<Object, Object> map, IPage page);
37
+    
38
+    /**
39
+     * 查看是否有未认证数据
40
+     * @param ownerTel
41
+     * @param communityId
42
+     * @return
43
+     */
44
+    TaUser selectByTel(@Param("loginName") String ownerTel,@Param("communityId") Integer communityId);
45
+    
46
+    int batchUpdate(List<TaUser> updataTaUserList);
47
+
13 48
 }

+ 4
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java Dosyayı Görüntüle

@@ -24,5 +24,8 @@ public interface TpBuildingOwnerInfoMapper extends BaseMapper<TpBuildingOwnerInf
24 24
      * @return
25 25
      */
26 26
     List<TpBuildingOwnerInfo> selectUserApprove(@Param("ownerName") String r , @Param("ownerTel") String ownerTel , Page page);
27
-
27
+    
28
+    int batchInsert(List<TpBuildingOwnerInfo> list);
29
+    
30
+    int batchUpdate(List<TpBuildingOwnerInfo> list);
28 31
 }

+ 9
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java Dosyayı Görüntüle

@@ -2,6 +2,7 @@ package com.community.huiju.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
5 6
 import com.community.huiju.model.TpBuildingOwnerInfo;
6 7
 import org.springframework.web.multipart.MultipartFile;
7 8
 
@@ -60,5 +61,12 @@ public interface IBuildingOwnerInfoService extends IService<TpBuildingOwnerInfo>
60 61
      * @return
61 62
      */
62 63
     ResponseBean getBuildingOrUnitOrNumber(String parameter, Integer communityId);
63
-
64
+    
65
+    /**
66
+     * 上传excel里面的内容
67
+     * @param file
68
+     * @param userElement
69
+     * @return
70
+     */
71
+    ResponseBean submitExcelData(MultipartFile file, UserElement userElement);
64 72
 }

+ 61
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Dosyayı Görüntüle

@@ -7,11 +7,17 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 8
 import com.community.commom.constant.Constant;
9 9
 import com.community.commom.mode.ResponseBean;
10
+import com.community.commom.session.UserElement;
10 11
 import com.community.commom.utils.AccountValidatorUtil;
11 12
 import com.community.commom.utils.BeanTools;
12
-import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
13
+
14
+import com.community.huiju.dao.TaUserMapper;
13 15
 import com.community.huiju.exception.WisdomException;
16
+import com.community.huiju.model.TaUser;
17
+
18
+import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
14 19
 import com.community.huiju.model.TpBuildingOwnerInfo;
20
+
15 21
 import com.community.huiju.service.IBuildingOwnerInfoService;
16 22
 import com.google.common.collect.Maps;
17 23
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -50,6 +56,9 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
50 56
     @Autowired
51 57
     private TpBuildingOwnerInfoMapper tpBuildingOwnerInfoMapper;
52 58
     
59
+    @Autowired
60
+    private TaUserMapper taUserMapper;
61
+    
53 62
     public static final Logger logger = LoggerFactory.getLogger(BuildingOwnerInfoServiceImpl.class);
54 63
     
55 64
     @Override
@@ -200,6 +209,57 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
200 209
         return responseBean;
201 210
     }
202 211
     
212
+    /**
213
+     * 上传excel里面的内容
214
+     *
215
+     * @param file
216
+     * @param userElement
217
+     * @return
218
+     */
219
+    @Override
220
+    public ResponseBean submitExcelData(MultipartFile file, UserElement userElement) {
221
+        ResponseBean responseBean = new ResponseBean();
222
+        responseBean = getExcelData(file);
223
+        if (!responseBean.getCode().equals(Constant.RESPONSE_SUCCESS)){
224
+            return responseBean;
225
+        }
226
+        //获取要上传的数据
227
+        Map<String,Object> map = (Map<String, Object>) responseBean.getData();
228
+        List<TpBuildingOwnerInfo> list = (List<TpBuildingOwnerInfo>) map.get("list");
229
+        list.stream().forEach(BuildingOwnerInfo -> {
230
+            BuildingOwnerInfo.setCommunityId(userElement.getCommunityId());
231
+            BuildingOwnerInfo.setVerifyStatus(Constant.UN_VERIFY_STATUS);
232
+            BuildingOwnerInfo.setCreateUser(userElement.getId());
233
+            BuildingOwnerInfo.setCreateDate(LocalDateTime.now());
234
+            BuildingOwnerInfo.setUpdateUser(userElement.getId());
235
+            BuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
236
+        });
237
+        //批量插入
238
+	    tpBuildingOwnerInfoMapper.batchInsert(list);
239
+        //判断是否认证过
240
+        List<TpBuildingOwnerInfo> updateList = new ArrayList<TpBuildingOwnerInfo>();
241
+        List<TaUser> updataTaUserList = new ArrayList<TaUser>();
242
+        list.stream().forEach(BuildingOwnerInfo -> {
243
+            TaUser taUser = taUserMapper.selectByTel(BuildingOwnerInfo.getOwnerTel(),BuildingOwnerInfo.getCommunityId());
244
+            if (null != taUser){
245
+                BuildingOwnerInfo.setVerifyStatus(Constant.VERIFY_STATUS);
246
+                updateList.add(BuildingOwnerInfo);
247
+                taUser.setVerifyStatus(Constant.VERIFY_STATUS);
248
+                taUser.setBuildingOwnerInfoId(BuildingOwnerInfo.getId());
249
+                updataTaUserList.add(taUser);
250
+            }
251
+        });
252
+        //批量更新
253
+        if (updateList.size() > 0){
254
+	        tpBuildingOwnerInfoMapper.batchUpdate(updateList);
255
+        }
256
+        if (updataTaUserList.size() > 0){
257
+            taUserMapper.batchUpdate(updataTaUserList);
258
+        }
259
+        responseBean.addSuccess("success");
260
+        return responseBean;
261
+    }
262
+    
203 263
     /**
204 264
      * 根据excel获取相关信息
205 265
      *

+ 3
- 0
CODE/smart-community/property-api/src/main/resources/application.yml Dosyayı Görüntüle

@@ -5,6 +5,9 @@ management:
5 5
         include: refresh,health,info
6 6
 ##mybatis-plus
7 7
 mybatis-plus:
8
+  global-config:
9
+    db-config:
10
+      id-type: auto
8 11
   configuration:
9 12
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql语句,调试用
10 13
   mapper-locations: classpath:mapper/*.xml

+ 318
- 0
CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml Dosyayı Görüntüle

@@ -1,4 +1,322 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3
 <mapper namespace="com.community.huiju.dao.TaUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="building_owner_info_id" property="buildingOwnerInfoId" jdbcType="INTEGER" />
8
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
9
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
11
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
12
+    <result column="email" property="email" jdbcType="VARCHAR" />
13
+    <result column="gender" property="gender" jdbcType="CHAR" />
14
+    <result column="status" property="status" jdbcType="CHAR" />
15
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
16
+    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
17
+    <result column="accept_agreement_status" property="acceptAgreementStatus" jdbcType="CHAR" />
18
+    <result column="verify_status" property="verifyStatus" jdbcType="CHAR" />
19
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
20
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
21
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
22
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23
+    <result column="hk_user_id" property="hkUserId" jdbcType="INTEGER" />
24
+    <result column="hk_card_no" property="hkCardNo" jdbcType="VARCHAR" />
25
+    <result column="face_status" property="faceStatus" jdbcType="CHAR" />
26
+  </resultMap>
27
+  <sql id="Base_Column_List" >
28
+    id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password,
29
+    email, gender, status, remark, parent_id, accept_agreement_status, verify_status,
30
+    create_user, create_date, update_user, update_date, hk_user_id, hk_card_no, face_status
31
+  </sql>
32
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
33
+    select
34
+    <include refid="Base_Column_List" />
35
+    from ta_user
36
+    where id = #{id,jdbcType=INTEGER}
37
+  </select>
38
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
39
+    delete from ta_user
40
+    where id = #{id,jdbcType=INTEGER}
41
+  </delete>
42
+  <insert id="insert" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
43
+    insert into ta_user (id, community_id, building_owner_info_id,
44
+      head_portrait, user_name, login_name,
45
+      login_password, email, gender,
46
+      status, remark, parent_id,
47
+      accept_agreement_status, verify_status, create_user,
48
+      create_date, update_user, update_date,
49
+      hk_user_id, hk_card_no, face_status
50
+      )
51
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{buildingOwnerInfoId,jdbcType=INTEGER},
52
+      #{headPortrait,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
53
+      #{loginPassword,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},
54
+      #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
55
+      #{acceptAgreementStatus,jdbcType=CHAR}, #{verifyStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER},
56
+      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},
57
+      #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
58
+      )
59
+  </insert>
60
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
61
+    insert into ta_user
62
+    <trim prefix="(" suffix=")" suffixOverrides="," >
63
+      <if test="id != null" >
64
+        id,
65
+      </if>
66
+      <if test="communityId != null" >
67
+        community_id,
68
+      </if>
69
+      <if test="buildingOwnerInfoId != null" >
70
+        building_owner_info_id,
71
+      </if>
72
+      <if test="headPortrait != null" >
73
+        head_portrait,
74
+      </if>
75
+      <if test="userName != null" >
76
+        user_name,
77
+      </if>
78
+      <if test="loginName != null" >
79
+        login_name,
80
+      </if>
81
+      <if test="loginPassword != null" >
82
+        login_password,
83
+      </if>
84
+      <if test="email != null" >
85
+        email,
86
+      </if>
87
+      <if test="gender != null" >
88
+        gender,
89
+      </if>
90
+      <if test="status != null" >
91
+        status,
92
+      </if>
93
+      <if test="remark != null" >
94
+        remark,
95
+      </if>
96
+      <if test="parentId != null" >
97
+        parent_id,
98
+      </if>
99
+      <if test="acceptAgreementStatus != null" >
100
+        accept_agreement_status,
101
+      </if>
102
+      <if test="verifyStatus != null" >
103
+        verify_status,
104
+      </if>
105
+      <if test="createUser != null" >
106
+        create_user,
107
+      </if>
108
+      <if test="createDate != null" >
109
+        create_date,
110
+      </if>
111
+      <if test="updateUser != null" >
112
+        update_user,
113
+      </if>
114
+      <if test="updateDate != null" >
115
+        update_date,
116
+      </if>
117
+      <if test="hkUserId != null" >
118
+        hk_user_id,
119
+      </if>
120
+      <if test="hkCardNo != null" >
121
+        hk_card_no,
122
+      </if>
123
+      <if test="faceStatus != null" >
124
+        face_status,
125
+      </if>
126
+    </trim>
127
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
128
+      <if test="id != null" >
129
+        #{id,jdbcType=INTEGER},
130
+      </if>
131
+      <if test="communityId != null" >
132
+        #{communityId,jdbcType=INTEGER},
133
+      </if>
134
+      <if test="buildingOwnerInfoId != null" >
135
+        #{buildingOwnerInfoId,jdbcType=INTEGER},
136
+      </if>
137
+      <if test="headPortrait != null" >
138
+        #{headPortrait,jdbcType=VARCHAR},
139
+      </if>
140
+      <if test="userName != null" >
141
+        #{userName,jdbcType=VARCHAR},
142
+      </if>
143
+      <if test="loginName != null" >
144
+        #{loginName,jdbcType=VARCHAR},
145
+      </if>
146
+      <if test="loginPassword != null" >
147
+        #{loginPassword,jdbcType=VARCHAR},
148
+      </if>
149
+      <if test="email != null" >
150
+        #{email,jdbcType=VARCHAR},
151
+      </if>
152
+      <if test="gender != null" >
153
+        #{gender,jdbcType=CHAR},
154
+      </if>
155
+      <if test="status != null" >
156
+        #{status,jdbcType=CHAR},
157
+      </if>
158
+      <if test="remark != null" >
159
+        #{remark,jdbcType=VARCHAR},
160
+      </if>
161
+      <if test="parentId != null" >
162
+        #{parentId,jdbcType=INTEGER},
163
+      </if>
164
+      <if test="acceptAgreementStatus != null" >
165
+        #{acceptAgreementStatus,jdbcType=CHAR},
166
+      </if>
167
+      <if test="verifyStatus != null" >
168
+        #{verifyStatus,jdbcType=CHAR},
169
+      </if>
170
+      <if test="createUser != null" >
171
+        #{createUser,jdbcType=INTEGER},
172
+      </if>
173
+      <if test="createDate != null" >
174
+        #{createDate,jdbcType=TIMESTAMP},
175
+      </if>
176
+      <if test="updateUser != null" >
177
+        #{updateUser,jdbcType=INTEGER},
178
+      </if>
179
+      <if test="updateDate != null" >
180
+        #{updateDate,jdbcType=TIMESTAMP},
181
+      </if>
182
+      <if test="hkUserId != null" >
183
+        #{hkUserId,jdbcType=INTEGER},
184
+      </if>
185
+      <if test="hkCardNo != null" >
186
+        #{hkCardNo,jdbcType=VARCHAR},
187
+      </if>
188
+      <if test="faceStatus != null" >
189
+        #{faceStatus,jdbcType=CHAR},
190
+      </if>
191
+    </trim>
192
+  </insert>
193
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUser" >
194
+    update ta_user
195
+    <set >
196
+      <if test="communityId != null" >
197
+        community_id = #{communityId,jdbcType=INTEGER},
198
+      </if>
199
+      <if test="buildingOwnerInfoId != null" >
200
+        building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
201
+      </if>
202
+      <if test="headPortrait != null" >
203
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
204
+      </if>
205
+      <if test="userName != null" >
206
+        user_name = #{userName,jdbcType=VARCHAR},
207
+      </if>
208
+      <if test="loginName != null" >
209
+        login_name = #{loginName,jdbcType=VARCHAR},
210
+      </if>
211
+      <if test="loginPassword != null" >
212
+        login_password = #{loginPassword,jdbcType=VARCHAR},
213
+      </if>
214
+      <if test="email != null" >
215
+        email = #{email,jdbcType=VARCHAR},
216
+      </if>
217
+      <if test="gender != null" >
218
+        gender = #{gender,jdbcType=CHAR},
219
+      </if>
220
+      <if test="status != null" >
221
+        status = #{status,jdbcType=CHAR},
222
+      </if>
223
+      <if test="remark != null" >
224
+        remark = #{remark,jdbcType=VARCHAR},
225
+      </if>
226
+      <if test="parentId != null" >
227
+        parent_id = #{parentId,jdbcType=INTEGER},
228
+      </if>
229
+      <if test="acceptAgreementStatus != null" >
230
+        accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
231
+      </if>
232
+      <if test="verifyStatus != null" >
233
+        verify_status = #{verifyStatus,jdbcType=CHAR},
234
+      </if>
235
+      <if test="createUser != null" >
236
+        create_user = #{createUser,jdbcType=INTEGER},
237
+      </if>
238
+      <if test="createDate != null" >
239
+        create_date = #{createDate,jdbcType=TIMESTAMP},
240
+      </if>
241
+      <if test="updateUser != null" >
242
+        update_user = #{updateUser,jdbcType=INTEGER},
243
+      </if>
244
+      <if test="updateDate != null" >
245
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
246
+      </if>
247
+      <if test="hkUserId != null" >
248
+        hk_user_id = #{hkUserId,jdbcType=INTEGER},
249
+      </if>
250
+      <if test="hkCardNo != null" >
251
+        hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
252
+      </if>
253
+      <if test="faceStatus != null" >
254
+        face_status = #{faceStatus,jdbcType=CHAR},
255
+      </if>
256
+    </set>
257
+    where id = #{id,jdbcType=INTEGER}
258
+  </update>
259
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaUser" >
260
+    update ta_user
261
+    set community_id = #{communityId,jdbcType=INTEGER},
262
+      building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
263
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
264
+      user_name = #{userName,jdbcType=VARCHAR},
265
+      login_name = #{loginName,jdbcType=VARCHAR},
266
+      login_password = #{loginPassword,jdbcType=VARCHAR},
267
+      email = #{email,jdbcType=VARCHAR},
268
+      gender = #{gender,jdbcType=CHAR},
269
+      status = #{status,jdbcType=CHAR},
270
+      remark = #{remark,jdbcType=VARCHAR},
271
+      parent_id = #{parentId,jdbcType=INTEGER},
272
+      accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
273
+      verify_status = #{verifyStatus,jdbcType=CHAR},
274
+      create_user = #{createUser,jdbcType=INTEGER},
275
+      create_date = #{createDate,jdbcType=TIMESTAMP},
276
+      update_user = #{updateUser,jdbcType=INTEGER},
277
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
278
+      hk_user_id = #{hkUserId,jdbcType=INTEGER},
279
+      hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
280
+      face_status = #{faceStatus,jdbcType=CHAR}
281
+    where id = #{id,jdbcType=INTEGER}
282
+  </update>
283
+  <select id="selectUserApprove" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TaUser">
284
+    SELECT
285
+    t.user_name,
286
+    t.login_name ,
287
+    t.gender ,
288
+    boi.id_card ,
289
+    boi.unit ,
290
+    boi. LEVEL,
291
+    room_no,
292
+    boi.create_date,
293
+    t.verify_status
294
+    FROM
295
+    ta_user t
296
+    LEFT JOIN tp_building_owner_info boi ON t.building_owner_info_id = boi.id
297
+    LEFT JOIN ta_sys_user_role sur ON t.id=sur.user_id
298
+    WHERE
299
+    andsur.role_id=1 and t.status=1 and t.verify_status=1
300
+  </select>
301
+
302
+  <select id="selectByTel" resultMap="BaseResultMap">
303
+    select
304
+    <include refid="Base_Column_List" />
305
+    from ta_user
306
+    where login_name = #{loginName,jdbcType=VARCHAR}
307
+    and community_id = #{communityId,jdbcType=INTEGER}
308
+    and verify_status = 0
309
+  </select>
310
+
311
+  <update id="batchUpdate" parameterType="java.util.ArrayList">
312
+    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
313
+      update ta_user
314
+      <set>
315
+        verify_status=${item.verifyStatus},
316
+        building_owner_info_id = #{item.buildingOwnerInfoId}
317
+      </set>
318
+      where id = ${item.id}
319
+    </foreach>
320
+  </update>
321
+
4 322
 </mapper>

+ 19
- 0
CODE/smart-community/property-api/src/main/resources/mapper/ToCommunitiesMapper.xml Dosyayı Görüntüle

@@ -2,4 +2,23 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.community.huiju.dao.ToCommunitiesMapper">
4 4
 
5
+    <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.ArrayList">
6
+        insert into tp_building_owner_info(community_id,id_card, building,unit, `level`,
7
+        room_no,owner_name,owner_tel,gender,pair_status,verify_status,create_user,create_date,update_user,update_date)
8
+        VALUES
9
+        <foreach collection="list" item="item" index="index" separator=",">
10
+            (#{item.communityId},#{item.idCard},#{item.building},#{item.unit}, #{item.level},#{item.roomNo},#{item.ownerName},
11
+            #{item.ownerTel},#{item.gender},#{item.pairStatus},#{item.verifyStatus},#{item.createUser},#{item.createDate},#{item.updateUser},#{item.updateDate})
12
+        </foreach>
13
+    </insert>
14
+
15
+    <update id="batchUpdate" parameterType="java.util.ArrayList">
16
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
17
+            update tp_building_owner_info
18
+            <set>
19
+                verify_status=${item.verifyStatus}
20
+            </set>
21
+            where id = ${item.id}
22
+        </foreach>
23
+    </update>
5 24
 </mapper>

+ 19
- 1
CODE/smart-community/property-api/src/main/resources/mapper/TpBuildingOwnerInfoMapper.xml Dosyayı Görüntüle

@@ -23,8 +23,26 @@
23 23
             </if>
24 24
             and tp_building_owner_info.pair_status=1
25 25
         </where>
26
+    </select>
26 27
 
28
+    <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.ArrayList">
29
+        insert into tp_building_owner_info(community_id,id_card, building,unit, `level`,
30
+        room_no,owner_name,owner_tel,gender,pair_status,verify_status,create_user,create_date,update_user,update_date)
31
+        VALUES
32
+        <foreach collection="list" item="item" index="index" separator=",">
33
+            (#{item.communityId},#{item.idCard},#{item.building},#{item.unit}, #{item.level},#{item.roomNo},#{item.ownerName},
34
+            #{item.ownerTel},#{item.gender},#{item.pairStatus},#{item.verifyStatus},#{item.createUser},#{item.createDate},#{item.updateUser},#{item.updateDate})
35
+        </foreach>
36
+    </insert>
27 37
 
28
-    </select>
38
+    <update id="batchUpdate" parameterType="java.util.ArrayList">
39
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
40
+            update tp_building_owner_info
41
+            <set>
42
+                verify_status=${item.verifyStatus}
43
+            </set>
44
+            where id = ${item.id}
45
+        </foreach>
46
+    </update>
29 47
 
30 48
 </mapper>

+ 15
- 0
VUECODE/smart-property-manage/src/api/batchImport.js Dosyayı Görüntüle

@@ -14,3 +14,18 @@ export function uploadBuildingExcel(query) {
14 14
     })
15 15
   })
16 16
 }
17
+
18
+export function submitBuildingExcel(query) {
19
+  return new Promise((resolve, reject) => {
20
+    request({
21
+      url: '/building/submitExcel',
22
+      method: 'post',
23
+      data: query
24
+    }).then((res) => {
25
+      console.log('out')
26
+      resolve(res)
27
+    }).catch((err) => {
28
+      console.log(err)
29
+    })
30
+  })
31
+}

+ 10
- 2
VUECODE/smart-property-manage/src/store/modules/batchImport.js Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-import { uploadBuildingExcel } from '@/api/batchImport'
1
+import { uploadBuildingExcel, submitBuildingExcel } from '@/api/batchImport'
2 2
 
3 3
 const batchImport = {
4 4
   namespaced: true,
@@ -18,7 +18,6 @@ const batchImport = {
18 18
 
19 19
   actions: {
20 20
     UploadBuildingExcel({ commit }, file) {
21
-      console.log(file)
22 21
       return new Promise((resolve, reject) => {
23 22
         uploadBuildingExcel({ file: file.raw }).then(response => {
24 23
           if (response.code === '0') {
@@ -31,6 +30,15 @@ const batchImport = {
31 30
           reject(error)
32 31
         })
33 32
       })
33
+    },
34
+    SubmitBuildingExcel({ commit }, file) {
35
+      return new Promise((resolve, reject) => {
36
+        submitBuildingExcel({ file: file.raw }).then(response => {
37
+          resolve(response)
38
+        }).catch(error => {
39
+          reject(error)
40
+        })
41
+      })
34 42
     }
35 43
   }
36 44
 }

+ 64
- 35
VUECODE/smart-property-manage/src/views/building/batch/batchImport.vue Dosyayı Görüntüle

@@ -3,14 +3,15 @@
3 3
   <div class="root">
4 4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
5 5
       <el-form-item>
6
-        <el-upload :on-preview="handlePreview" :on-change="handleChange" :before-upload="beforeUpload" :limit="1" :on-exceed="handleExceed" :file-list="fileList" class="upload-demo" action="" multiple>
6
+        <el-upload :on-preview="handlePreview" :on-change="handleChange" :before-upload="beforeUpload" :limit="1" :on-exceed="handleExceed" class="upload-demo" action="" multiple>
7 7
           <el-button style="margin-left: 10px;" size="large" type="primary">下载模板</el-button>
8 8
           <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
9 9
           <el-button style="margin-left: 10px;" size="large" type="success" @click="submitUpload">提交</el-button>
10
+          <el-button style="margin-left: 10px;" size="large" type="success" @click="dialogBuildingIndex">取消</el-button>
10 11
         </el-upload>
11 12
       </el-form-item>
12 13
     </el-form>
13
-    <el-table ref="multipleTable" :data="list" border tooltip-effect="dark" style="width: 100%; margin-top: 20px;" @selection-change="handleSelectionChange">
14
+    <el-table ref="multipleTable" :data="list" border tooltip-effect="dark" style="width: 100%; margin-top: 20px;">
14 15
       <el-table-column label="栋">
15 16
         <template slot-scope="scope">{{ scope.row.building }}</template>
16 17
       </el-table-column>
@@ -31,13 +32,13 @@
31 32
       </el-table-column>
32 33
     </el-table>
33 34
     <div class="block">
34
-      <el-pagination :current-page="listQuery.pageNum" :page-sizes="[5, 10, 20, 30]" :page-size="listQuery.pageSize" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange"/>
35
+      <el-pagination :current-page="listQuery.pageNum" :page-sizes="[5, 10, 20, 30]" :page-size="listQuery.pageSize" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
35 36
     </div>
36 37
   </div>
37 38
 </template>
38 39
 
39 40
 <script>
40
-import { mapState, mapActions } from 'vuex'
41
+import { mapState, mapActions } from "vuex";
41 42
 export default {
42 43
   data() {
43 44
     return {
@@ -46,73 +47,101 @@ export default {
46 47
         pageSize: 20
47 48
       },
48 49
       list: [],
50
+      files: null,
49 51
       currentPage4: 4
50
-    }
52
+    };
51 53
   },
52 54
   computed: {
53
-    ...mapState('batchImport', {
55
+    ...mapState("batchImport", {
54 56
       temlist: s => s.temlist,
55 57
       total: s => s.total
56 58
     })
57 59
   },
58 60
   created() {
59
-    console.log(mapActions)
61
+    console.log(mapActions);
60 62
   },
61 63
   methods: {
62
-    ...mapActions('batchImport', ['UploadBuildingExcel']),
64
+    ...mapActions("batchImport", [
65
+      "UploadBuildingExcel",
66
+      "SubmitBuildingExcel"
67
+    ]),
63 68
     handleSizeChange(val) {
64
-      this.listQuery.pageSize = val
65
-      this.getList()
66
-      console.log(`每页 ${val} 条`)
69
+      this.listQuery.pageSize = val;
70
+      this.getList();
71
+      console.log(`每页 ${val} 条`);
67 72
     },
68 73
     handleCurrentChange(val) {
69
-      this.listQuery.pageNum = val
70
-      this.getList()
71
-      console.log(`当前页: ${val}`)
74
+      this.listQuery.pageNum = val;
75
+      this.getList();
76
+      console.log(`当前页: ${val}`);
72 77
     },
73 78
     dialogBatchImport() {
74
-      this.$router.push({ name: 'batch-import' })
79
+      this.$router.push({ name: "batch-import" });
75 80
     },
76 81
     beforeUpload(file) {
77
-      this.files = file
78
-      const extension = file.name.split('.')[1] === 'xls'
79
-      const extension2 = file.name.split('.')[1] === 'xlsx'
82
+      const extension = file.name.split(".")[1] === "xls";
83
+      const extension2 = file.name.split(".")[1] === "xlsx";
80 84
       if (!extension && !extension2) {
81
-        this.$message.warning('上传文件只能是 xls、xlsx格式!')
82
-        return
85
+        this.$message.warning("上传文件只能是 xls、xlsx格式!");
86
+        return;
83 87
       }
84
-      return false // 返回false不会自动上传
88
+      this.files = file;
89
+      return false; // 返回false不会自动上传
85 90
     },
86 91
     handleChange(file) {
87
-      const fileName = file.name
88
-      if (fileName === '') {
89
-        this.$message.warning('请选择要上传的文件!')
90
-        return false
92
+      const fileName = file.name;
93
+      if (fileName === "") {
94
+        this.$message.warning("请选择要上传的文件!");
95
+        return false;
91 96
       }
92 97
       this.UploadBuildingExcel(file)
93 98
         .then(response => {
94
-          console.log('success')
95
-          if (response.code === '1') {
96
-            this.$message.warning(response.message)
99
+          if (response.code === "1") {
100
+            this.$message.warning(response.message);
97 101
           }
98
-          if (response.code === '0') {
99
-            this.$message.success('上传成功')
100
-            this.getList()
102
+          if (response.code === "0") {
103
+            this.$message.success("上传成功");
104
+            this.getList();
101 105
           }
102 106
         })
103 107
         .catch(() => {
104
-          console.log('upload error')
108
+          console.log("upload error");
109
+        });
110
+    },
111
+    submitUpload() {
112
+      if (this.files === null) {
113
+        this.$message.warning("没有需要提交的文件");
114
+        return false;
115
+      }
116
+      let file = {
117
+        raw: this.files
118
+      };
119
+      this.SubmitBuildingExcel(file)
120
+        .then(response => {
121
+          if (response.code === "1") {
122
+            this.$message.warning(response.message);
123
+          }
124
+          if (response.code === "0") {
125
+            this.$message.success("提交成功");
126
+            this.dialogBuildingIndex();
127
+          }
105 128
         })
129
+        .catch(() => {
130
+          console.log("upload error");
131
+        });
106 132
     },
107 133
     getList() {
108 134
       this.list = this.temlist.slice(
109 135
         (this.listQuery.pageNum - 1) * this.listQuery.pageSize,
110 136
         this.listQuery.pageNum * this.listQuery.pageSize
111
-      )
112
-      console.log(this.list)
137
+      );
138
+      console.log(this.list);
139
+    },
140
+    dialogBuildingIndex() {
141
+      this.$router.push({ name: "building-index" });
113 142
     }
114 143
   }
115
-}
144
+};
116 145
 </script>
117 146
 
118 147
 <style scoped>