魏熙美 6 år sedan
förälder
incheckning
fed86f4bb6

+ 3
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BillController.java Visa fil

@@ -40,13 +40,12 @@ public class BillController extends BaseController {
40 40
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
41 41
 			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
42 42
 	})
43
-	@RequestMapping(value = "/bills/{communityId}/{payType}",method = RequestMethod.GET)
43
+	@RequestMapping(value = "/bills/current_user/{payType}",method = RequestMethod.GET)
44 44
 	public ResponseBean getBillInvoice(@PathVariable Integer communityId,
45 45
 									   @PathVariable Integer payType,
46 46
 									   @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47 47
 									   @RequestParam(value ="pageSize",defaultValue = "5") Integer pageSize, HttpSession session){
48
-		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
49
-		Integer userId = userElement.getId();
48
+		UserElement userElement = getUserElement(session);
50 49
 		ResponseBean responseBean = new ResponseBean();
51 50
 
52 51
 		if (!check(communityId)) {
@@ -54,7 +53,7 @@ public class BillController extends BaseController {
54 53
 			return responseBean;
55 54
 		}
56 55
 
57
-		Map<String, Object> map = billServiceI.getBillsList(communityId, payType, userId, pageNum, pageSize);
56
+		Map<String, Object> map = billServiceI.getBillsList(userElement, payType, pageNum, pageSize);
58 57
 		responseBean.addSuccess(map);
59 58
 		return responseBean;
60 59
 	}

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBillInvoiceMapper.java Visa fil

@@ -24,11 +24,11 @@ public interface TpBillInvoiceMapper {
24 24
     /**
25 25
      * 分页获取缴费和未缴费的数据
26 26
      * @param communityId
27
-     * @param userId
27
+     * @param buildingOwnerInfoId
28 28
      * @param payType
29 29
      * @return
30 30
      */
31
-    List<Map<String, Object>> getBillsList(@Param("communityId") Integer communityId,@Param("userId") Integer userId,@Param("payType") Integer payType);
31
+    List<Map<String, Object>> getBillsList(@Param("communityId") Integer communityId,@Param("buildingOwnerInfoId") Integer buildingOwnerInfoId,@Param("payType") Integer payType);
32 32
     
33 33
     /**
34 34
      * 获取账单的详细信息

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUserVerify.java Visa fil

@@ -27,6 +27,7 @@ public class TaUserVerify {
27 27
 
28 28
     private String levelName;
29 29
 
30
+    /** 就是楼栋资料库的id **/
30 31
     private Integer roomNoId;
31 32
 
32 33
     private String roomNoName;

+ 5
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/BillServiceI.java Visa fil

@@ -1,18 +1,21 @@
1 1
 package com.community.huiju.service;
2 2
 
3
+import com.community.commom.session.UserElement;
4
+
3 5
 import java.util.List;
4 6
 import java.util.Map;
5 7
 
6 8
 public interface BillServiceI {
7 9
 	/**
8 10
 	 * 根据payType分页获取缴费或未缴费的数据
9
-	 * @param communityId
11
+	 *
12
+	 * @param userElement
10 13
 	 * @param payType
11 14
 	 * @param pageNum
12 15
 	 * @param pageSize
13 16
 	 * @return
14 17
 	 */
15
-	Map<String, Object> getBillsList(Integer communityId, Integer payType, Integer userId ,Integer pageNum, Integer pageSize);
18
+	Map<String, Object> getBillsList(UserElement userElement, Integer payType, Integer pageNum, Integer pageSize);
16 19
 	
17 20
 	/**
18 21
 	 * 获取账单的详细信息

+ 13
- 10
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java Visa fil

@@ -1,10 +1,13 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.community.commom.session.UserElement;
3 4
 import com.community.huiju.dao.TaSysRoleMapper;
4 5
 import com.community.huiju.dao.TaUserMapper;
6
+import com.community.huiju.dao.TaUserVerifyMapper;
5 7
 import com.community.huiju.dao.TpBillInvoiceMapper;
6 8
 import com.community.huiju.model.TaSysRole;
7 9
 import com.community.huiju.model.TaUser;
10
+import com.community.huiju.model.TaUserVerify;
8 11
 import com.community.huiju.service.BillServiceI;
9 12
 import com.github.pagehelper.Page;
10 13
 import com.github.pagehelper.PageHelper;
@@ -30,30 +33,30 @@ public class BillServiceImpl implements BillServiceI {
30 33
 
31 34
 	@Autowired
32 35
 	private TaSysRoleMapper taSysRoleMapper;
36
+
37
+	@Autowired
38
+	private TaUserVerifyMapper taUserVerifyMapper;
33 39
 	
34 40
 	/**
35 41
 	 * 根据payType分页获取缴费或未缴费的数据
36
-	 * @param communityId
42
+	 * @param userElement
37 43
 	 * @param payType
38 44
 	 * @param pageNum
39 45
 	 * @param pageSize
40 46
 	 * @return
41 47
 	 */
42 48
 	@Override
43
-	public Map<String, Object> getBillsList(Integer communityId, Integer payType, Integer userId ,Integer pageNum, Integer pageSize) {
49
+	public Map<String, Object> getBillsList(UserElement userElement, Integer payType, Integer pageNum, Integer pageSize) {
44 50
 		//使用分页插件
45 51
 		Page<Map<String,Object>> page = PageHelper.startPage(pageNum, pageSize);
46 52
 
47
-		TaUser taUser = taUserMapper.selectByPrimaryKey(userId);
53
+		/**
54
+		 * 账单 关联的是房产, 查询 审核表, 审核表里面的 roomNoId 就是楼栋资料库的id
55
+ 		 */
48 56
 
49
-		TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(userId);
50
-		// 如果不是业主
51
-		if (null != taSysRole && taSysRole.getId().intValue() != 1) {
52
-			TaUser ownerUser = taUserMapper.selectByPrimaryKey(taUser.getParentId());
53
-			userId = ownerUser.getId();
54
-		}
57
+		TaUserVerify userVerify = taUserVerifyMapper.selectByPrimaryKey(userElement.getUserVerifyId());
55 58
 
56
-		List<Map<String,Object>> billsList = tpBillInvoiceMapper.getBillsList(communityId, userId, payType);
59
+		List<Map<String,Object>> billsList = tpBillInvoiceMapper.getBillsList(userElement.getCommunityId(), userVerify.getRoomNoId(), payType);
57 60
 		billsList.forEach(e-> {
58 61
 			String payPrice = String.valueOf(e.get("payPrice"));
59 62
 			Double payPriceDouble = Double.parseDouble(payPrice) / 100;

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpBillInvoiceMapper.xml Visa fil

@@ -248,7 +248,7 @@
248 248
             AND (i.bill_status = 1 or i.bill_status = 2)
249 249
           </if>
250 250
           and i.status=1
251
-          AND i.ta_user_id = #{userId,jdbcType=INTEGER}
251
+          AND i.building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER}
252 252
   </select>
253 253
 
254 254
   <select id="getBillInvoiceDetail" resultType="map">