dingxin 6 年之前
父節點
當前提交
72ecdc03b7
共有 20 個文件被更改,包括 238 次插入107 次删除
  1. 4
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBillInvoiceMapper.java
  2. 12
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  3. 17
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpBillInvoiceMapper.xml
  4. 9
    1
      CODE/smart-community/property-api/pom.xml
  5. 9
    5
      CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java
  6. 6
    7
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BillController.java
  7. 2
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBillService.java
  8. 6
    6
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BillInvoiceServiceImpl.java
  9. 70
    50
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java
  10. 32
    10
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java
  11. 二進制
      CODE/smart-community/property-api/src/main/resources/缴费单模板.xls
  12. 8
    0
      VUECODE/smart-property-manage/src/api/bill.js
  13. 3
    3
      VUECODE/smart-property-manage/src/router/index.js
  14. 10
    1
      VUECODE/smart-property-manage/src/store/modules/bill.js
  15. 14
    1
      VUECODE/smart-property-manage/src/views/bill/add/index.vue
  16. 15
    2
      VUECODE/smart-property-manage/src/views/bill/edi/index.vue
  17. 2
    2
      VUECODE/smart-property-manage/src/views/bill/index.vue
  18. 1
    1
      VUECODE/smart-property-manage/src/views/bill/info/add/index.vue
  19. 1
    1
      VUECODE/smart-property-manage/src/views/bill/info/bill-edi/index.vue
  20. 17
    15
      VUECODE/smart-property-manage/src/views/bill/info/index.vue

+ 4
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBillInvoiceMapper.java 查看文件

47
 	TpBillInvoice selectByIdAndUserId(@Param("id") Integer billInvoiceId,@Param("userId") Integer userId,@Param("communityId") Integer communityId);
47
 	TpBillInvoice selectByIdAndUserId(@Param("id") Integer billInvoiceId,@Param("userId") Integer userId,@Param("communityId") Integer communityId);
48
     
48
     
49
     TpBillInvoice selectByOutTradeNo(@Param("outTradeNo") String outTradeNo);
49
     TpBillInvoice selectByOutTradeNo(@Param("outTradeNo") String outTradeNo);
50
+
51
+    List<TpBillInvoice> selectByBuildingOwnerInfoId(@Param("buildingOwnerInfoId") Integer buildingOwnerInfoId);
52
+
53
+    int updateBeach(Map<String, Object> map);
50
 }
54
 }

+ 12
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java 查看文件

68
     @Autowired
68
     @Autowired
69
     private TaFaceMapper taFaceMapper;
69
     private TaFaceMapper taFaceMapper;
70
 
70
 
71
+    @Autowired
72
+    private TpBillInvoiceMapper tpBillInvoiceMapper;
73
+
71
     @Transactional(rollbackFor = Exception.class)
74
     @Transactional(rollbackFor = Exception.class)
72
     @Override
75
     @Override
73
     @Deprecated
76
     @Deprecated
211
             buildingOwnerInfo.setUpdateDate(new Date());
214
             buildingOwnerInfo.setUpdateDate(new Date());
212
             tpBuildingOwnerInfoMapper.updateByPrimaryKeySelective(buildingOwnerInfo);
215
             tpBuildingOwnerInfoMapper.updateByPrimaryKeySelective(buildingOwnerInfo);
213
 
216
 
217
+            // 开始绑定缴费单
218
+            List<TpBillInvoice> tpBillInvoices = tpBillInvoiceMapper.selectByBuildingOwnerInfoId(buildingOwnerInfo.getId());
219
+            if (CollectionUtils.isNotEmpty(tpBillInvoices)) {
220
+                Map<String, Object> map = new HashMap<>();
221
+                map.put("taUserId", user.getId());
222
+                map.put("list", tpBillInvoices);
223
+                tpBillInvoiceMapper.updateBeach(map);
224
+            }
225
+
214
         }
226
         }
215
 
227
 
216
         // 更新
228
         // 更新

+ 17
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpBillInvoiceMapper.xml 查看文件

307
 	where t.out_trade_no = #{outTradeNo,jdbcType=VARCHAR}
307
 	where t.out_trade_no = #{outTradeNo,jdbcType=VARCHAR}
308
 	and t.status = 1
308
 	and t.status = 1
309
   </select>
309
   </select>
310
+
311
+    <select id="selectByBuildingOwnerInfoId" parameterType="integer" resultMap="BaseResultMap" >
312
+        select
313
+        <include refid="Base_Column_List"/>
314
+        from tp_bill_invoice
315
+        where bill_statement_id = #{buildingOwnerInfoId,jdbcType=INTEGER}
316
+    </select>
317
+
318
+    <update id="updateBeach" parameterType="map" >
319
+        update tp_bill_invoice
320
+        set ta_user_id = #{map.taUserId}
321
+        where id in
322
+      <foreach collection="map.list" item="item" index="index" separator="," open="(" close=")">
323
+          #{item.id}
324
+      </foreach>
325
+    </update>
326
+
310
 </mapper>
327
 </mapper>

+ 9
- 1
CODE/smart-community/property-api/pom.xml 查看文件

159
             <scope>compile</scope>
159
             <scope>compile</scope>
160
         </dependency>
160
         </dependency>
161
 
161
 
162
-    </dependencies>
162
+		<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
163
+		<dependency>
164
+			<groupId>com.alibaba</groupId>
165
+			<artifactId>easyexcel</artifactId>
166
+			<version>1.1.2-beat1</version>
167
+		</dependency>
168
+
169
+
170
+	</dependencies>
163
 
171
 
164
 	<dependencyManagement>
172
 	<dependencyManagement>
165
 		<dependencies>
173
 		<dependencies>

+ 9
- 5
CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java 查看文件

69
     protected void setResponseHeader(HttpServletResponse response, String fileName) {
69
     protected void setResponseHeader(HttpServletResponse response, String fileName) {
70
         try {
70
         try {
71
             try {
71
             try {
72
-                fileName = new String(fileName.getBytes(),"ISO8859-1");
72
+                fileName = new String(fileName.getBytes(),"utf-8");
73
             } catch (UnsupportedEncodingException e) {
73
             } catch (UnsupportedEncodingException e) {
74
                 // TODO Auto-generated catch block
74
                 // TODO Auto-generated catch block
75
                 e.printStackTrace();
75
                 e.printStackTrace();
76
             }
76
             }
77
-            response.setContentType("application/octet-stream;charset=ISO8859-1");
78
-            response.setHeader("Content-Disposition", "attachment;filename="+ fileName);
79
-            response.addHeader("Pargam", "no-cache");
80
-            response.addHeader("Cache-Control", "no-cache");
77
+//            response.setContentType("application/octet-stream;charset=ISO8859-1");
78
+//            response.setHeader("Content-Disposition", "attachment;filename="+ fileName);
79
+//            response.addHeader("Pargam", "no-cache");
80
+//            response.addHeader("Cache-Control", "no-cache");
81
+
82
+            response.setContentType("multipart/form-data");
83
+            response.setCharacterEncoding("utf-8");
84
+            response.setHeader("Content-disposition", "attachment;filename="+fileName);
81
         } catch (Exception ex) {
85
         } catch (Exception ex) {
82
             ex.printStackTrace();
86
             ex.printStackTrace();
83
         }
87
         }

+ 6
- 7
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BillController.java 查看文件

143
 
143
 
144
     @ApiOperation(value = "下载Excel模板", notes = "下载Excel模板")
144
     @ApiOperation(value = "下载Excel模板", notes = "下载Excel模板")
145
     @ApiImplicitParams({
145
     @ApiImplicitParams({
146
-            @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "billExplain收费组说明"),
147
-//            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
146
+//            @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "billExplain收费组说明"),
147
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
148
     })
148
     })
149
-    @RequestMapping(value = "/bill/downloadExcel", method = RequestMethod.POST)
150
-    public void exportExcel(HttpServletResponse response, HttpSession session, @RequestBody String parameter) {
151
-        ResponseBean responseBean = new ResponseBean();
152
-//        UserElement userElement = getUserElement(session);
153
-        HSSFWorkbook workbook = (HSSFWorkbook) iBillService.downloadExcel(parameter).getData();
149
+    @RequestMapping(value = "/bill/downloadExcel", method = RequestMethod.GET)
150
+    public void exportExcel(HttpServletResponse response, HttpSession session) {
151
+        UserElement userElement = getUserElement(session);
152
+        HSSFWorkbook workbook = (HSSFWorkbook) iBillService.downloadExcel(userElement).getData();
154
         this.setResponseHeader(response, "缴费单模板.xls");
153
         this.setResponseHeader(response, "缴费单模板.xls");
155
         //响应到客户端
154
         //响应到客户端
156
         try {
155
         try {

+ 2
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBillService.java 查看文件

81
 
81
 
82
 	/**
82
 	/**
83
 	 * 下载 excel 模板
83
 	 * 下载 excel 模板
84
-	 * @param parameter
84
+	 * @param userElement
85
 	 * @return
85
 	 * @return
86
 	 */
86
 	 */
87
-	ResponseBean downloadExcel(String parameter);
87
+	ResponseBean downloadExcel(UserElement userElement);
88
 }
88
 }

+ 6
- 6
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BillInvoiceServiceImpl.java 查看文件

226
         Double payPrice = jsonObject.getDouble("payPrice");
226
         Double payPrice = jsonObject.getDouble("payPrice");
227
 
227
 
228
         // 判断是不是已经 收费完成
228
         // 判断是不是已经 收费完成
229
-        Bill bill = billMapper.selectById(billId);
230
-        if ("1".equals(bill.getBillStatus())) {
231
-            // 状态 收费完成, 不允许添加收费单
232
-            responseBean.addError("不能给收费已完成的收费组添加收费单!");
233
-            return responseBean;
234
-        }
229
+//        Bill bill = billMapper.selectById(billId);
230
+//        if ("1".equals(bill.getBillStatus())) {
231
+//            // 状态 收费完成, 不允许添加收费单
232
+//            responseBean.addError("不能给收费已完成的收费组添加收费单!");
233
+//            return responseBean;
234
+//        }
235
 
235
 
236
         // 楼栋资料库
236
         // 楼栋资料库
237
         QueryWrapper<TpBuildingOwnerInfo> queryWrapper = new QueryWrapper<>();
237
         QueryWrapper<TpBuildingOwnerInfo> queryWrapper = new QueryWrapper<>();

+ 70
- 50
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java 查看文件

14
 import com.community.huiju.model.*;
14
 import com.community.huiju.model.*;
15
 import com.community.huiju.service.IBillInvoiceService;
15
 import com.community.huiju.service.IBillInvoiceService;
16
 import com.community.huiju.service.IBillService;
16
 import com.community.huiju.service.IBillService;
17
+import com.community.huiju.service.IBuildingOwnerInfoService;
17
 import com.google.common.collect.Lists;
18
 import com.google.common.collect.Lists;
18
 import com.google.common.collect.Maps;
19
 import com.google.common.collect.Maps;
19
 import com.google.zxing.common.detector.MathUtils;
20
 import com.google.zxing.common.detector.MathUtils;
31
 import org.springframework.transaction.annotation.Transactional;
32
 import org.springframework.transaction.annotation.Transactional;
32
 import org.springframework.web.multipart.MultipartFile;
33
 import org.springframework.web.multipart.MultipartFile;
33
 
34
 
34
-import java.io.FileInputStream;
35
-import java.io.FileNotFoundException;
36
-import java.io.IOException;
37
-import java.io.InputStream;
35
+import java.io.*;
38
 import java.text.ParseException;
36
 import java.text.ParseException;
39
 import java.text.SimpleDateFormat;
37
 import java.text.SimpleDateFormat;
40
 import java.util.Date;
38
 import java.util.Date;
81
     @Autowired
79
     @Autowired
82
     private TaUserMapper taUserMapper;
80
     private TaUserMapper taUserMapper;
83
 
81
 
82
+    @Autowired
83
+    private IBuildingOwnerInfoService iBuildingOwnerInfoService;
84
 
84
 
85
     @Override
85
     @Override
86
     @Transactional(rollbackFor = Exception.class)
86
     @Transactional(rollbackFor = Exception.class)
229
 
229
 
230
         bill.setPayedNum(0);
230
         bill.setPayedNum(0);
231
         bill.setBillStatus(billStatus);
231
         bill.setBillStatus(billStatus);
232
-        bill.setCreateUser(userElement.getId());
233
         //为草稿时不创建时间
232
         //为草稿时不创建时间
234
         if(!"2".equals(billStatus)) {
233
         if(!"2".equals(billStatus)) {
235
             bill.setCreateDate(new Date());
234
             bill.setCreateDate(new Date());
235
+            bill.setCreateUser(userElement.getId());
236
         }
236
         }
237
         bill.setCommunityId(userElement.getCommunityId());
237
         bill.setCommunityId(userElement.getCommunityId());
238
         Integer payTotalNum = tempBills.size() != 0 ? tempBills.size() : records != null ? records.size() : 0;
238
         Integer payTotalNum = tempBills.size() != 0 ? tempBills.size() : records != null ? records.size() : 0;
250
         if (billId != null) {
250
         if (billId != null) {
251
             bill.setCreateUser(null);
251
             bill.setCreateUser(null);
252
             bill.setCreateDate(null);
252
             bill.setCreateDate(null);
253
+            if(!"2".equals(billStatus)) {
254
+                bill.setCreateDate(new Date());
255
+                bill.setCreateUser(userElement.getId());
256
+            }
253
             // 设置主键, 表示修改
257
             // 设置主键, 表示修改
254
             bill.setId(billId);
258
             bill.setId(billId);
255
         }
259
         }
271
                 queryWrapper.eq("room_no", e.getRoomNo());
275
                 queryWrapper.eq("room_no", e.getRoomNo());
272
                 queryWrapper.eq("community_id", userElement.getCommunityId());
276
                 queryWrapper.eq("community_id", userElement.getCommunityId());
273
                 TpBuildingOwnerInfo buildingOwnerInfo = tpBuildingOwnerInfoMapper.selectOne(queryWrapper);
277
                 TpBuildingOwnerInfo buildingOwnerInfo = tpBuildingOwnerInfoMapper.selectOne(queryWrapper);
278
+                if (null == buildingOwnerInfo) {
279
+                    throw new WisdomException("请输入正确的用户信息! ");
280
+                }
281
+
282
+                /**
283
+                 * 如果用户不在 app 里面,没有关联, 那么就设置 taUserId
284
+                 * 等业主第一次登陆的时候, 再去自动匹配上去
285
+                 */
274
 
286
 
275
-                // TODO 如果用户不在 app 里面,没有关联, 怎么处理?
276
                 // 查询app用户id
287
                 // 查询app用户id
277
                 QueryWrapper<TaUser> userQueryWrapper = new QueryWrapper<>();
288
                 QueryWrapper<TaUser> userQueryWrapper = new QueryWrapper<>();
278
                 userQueryWrapper.eq("community_id", userElement.getCommunityId());
289
                 userQueryWrapper.eq("community_id", userElement.getCommunityId());
280
                 TaUser taUser = taUserMapper.selectOne(userQueryWrapper);
291
                 TaUser taUser = taUserMapper.selectOne(userQueryWrapper);
281
 
292
 
282
                 billInvoice.setBuildingOwnerInfoId(buildingOwnerInfo.getId());
293
                 billInvoice.setBuildingOwnerInfoId(buildingOwnerInfo.getId());
283
-                billInvoice.setTaUserId(taUser.getId());
294
+                if (null != taUser) {
295
+                    billInvoice.setTaUserId(taUser.getId());
296
+                }
284
                 billInvoice.setBillInvoiceExplain(bill.getBillExplain());
297
                 billInvoice.setBillInvoiceExplain(bill.getBillExplain());
285
                 billInvoice.setPayPrice(e.getMoney());
298
                 billInvoice.setPayPrice(e.getMoney());
286
                 billInvoice.setBillStatus("0");
299
                 billInvoice.setBillStatus("0");
468
     }
481
     }
469
 
482
 
470
     @Override
483
     @Override
471
-    public ResponseBean downloadExcel(String parameter) {
484
+    public ResponseBean downloadExcel(UserElement userElement) {
472
         ResponseBean responseBean = new ResponseBean();
485
         ResponseBean responseBean = new ResponseBean();
473
 
486
 
474
         InputStream inputStream = null;
487
         InputStream inputStream = null;
488
+        inputStream = this.getClass().getResourceAsStream("/缴费单模板.xls");
489
+
475
         HSSFWorkbook workbook = null;
490
         HSSFWorkbook workbook = null;
476
         try {
491
         try {
477
-            inputStream = new FileInputStream("缴费单模板.xls");
478
             workbook = new HSSFWorkbook(inputStream);
492
             workbook = new HSSFWorkbook(inputStream);
479
-        } catch (FileNotFoundException e) {
480
-            e.printStackTrace();
481
         } catch (IOException e) {
493
         } catch (IOException e) {
482
             e.printStackTrace();
494
             e.printStackTrace();
483
         }
495
         }
484
 
496
 
485
-       
486
-        HSSFSheet sheet = workbook.createSheet("缴费单");
497
+        HSSFSheet sheet = workbook.getSheetAt(0);
487
         // 创建行
498
         // 创建行
488
-        HSSFRow row = sheet.createRow(0);
499
+        HSSFRow row = null;
489
         // 创建列
500
         // 创建列
490
-        HSSFCell cell = row.createCell(0);
491
-        cell.setCellValue("1.第1行到第4行为模板说明。第5行为列头。第6行为示例。第7行及以后行中的金额部分为需要您填写的区域。请不要删除任何列、说明以及示例等。");
492
-        row = sheet.createRow(1);
493
-        cell = row.createCell(0);
494
-        cell.setCellValue("2.下表中 栋/单元/楼层/房号/业主姓名为系统生成,自行增加、修改无效,只能修改金额!!!如果没有内容或缺失内容,请先登录物业系统,在 社区管理——业主/楼盘——楼盘库中添加楼盘信息,在社区管理——业主/楼盘——业主资料库中添加业主信息,完成后再重新下载账单模板。");
495
-        row = sheet.createRow(2);
496
-        cell = row.createCell(0);
497
-        cell.setCellValue("3.无需缴费的户可以直接在户所在行最左侧行号上点击右键删除行。");
498
-        row = sheet.createRow(3);
499
-        cell = row.createCell(0);
500
-        cell.setCellValue("4.需要缴费的户,在金额列中填写金额,默认单位为人民币元,请输入大于0的数字,小数点请用英文小数点,更不能使用句号。最多保留小数点后两位。若是复制粘贴的金额,请在粘贴后检查金额是否正确,系统暂时无法退费,请仔细核对账单");
501
-        row = sheet.createRow(4);
502
-        cell = row.createCell(0);
503
-        cell.setCellValue("期/区");
504
-        cell = row.createCell(1);
505
-        cell.setCellValue("栋");
506
-        cell = row.createCell(2);
507
-        cell.setCellValue("单元");
508
-        cell = row.createCell(3);
509
-        cell.setCellValue("楼层");
510
-        cell = row.createCell(4);
511
-        cell.setCellValue("房号");
512
-        cell = row.createCell(5);
513
-        cell.setCellValue("业主姓名");
514
-        cell = row.createCell(6);
515
-        cell.setCellValue("金额(元)");
516
-
517
-        String [] [] data = new String[][] {{"1区","0", "0", "0", "0", "示例忽删", "12.34", "<-示例"}};
518
-        int crrentRow = 5;
519
-        // 行数
520
-        for (int i = 0; i < data.length; i++) {
521
-            row = sheet.createRow(i + crrentRow);
522
-            for (int t = 0; t < data[i].length; t++) {
523
-                cell = row.createCell(t);
524
-                cell.setCellValue(data[i][t]);
501
+        HSSFCell cell = null;
502
+
503
+        Integer pageNum = 1;
504
+        Integer pageSize = 10;
505
+        Page<TpBuildingOwnerInfo> page = new Page(pageNum,pageSize);
506
+        // 分页查询
507
+        QueryWrapper<TpBuildingOwnerInfo> buildingOwnerInfoQueryWrapper = new QueryWrapper<>();
508
+        buildingOwnerInfoQueryWrapper.eq("community_id", userElement.getCommunityId());
509
+        IPage<TpBuildingOwnerInfo> infoIPage = tpBuildingOwnerInfoMapper.selectPage(page, buildingOwnerInfoQueryWrapper);
510
+        List<TpBuildingOwnerInfo> records = infoIPage.getRecords();
511
+        // 总页数
512
+        Long pages = infoIPage.getPages();
513
+        do {
514
+
515
+        } while (false);
516
+
517
+
518
+        // 行数 默认从 第 6 行开始
519
+        int currentRow = 6;
520
+        // 记录坐标
521
+        int index = 0;
522
+
523
+        do {
524
+            TpBuildingOwnerInfo buildingOwnerInfo = records.get(index);
525
+            row = sheet.createRow(currentRow);
526
+            cell = row.createCell(0);
527
+            cell.setCellValue(buildingOwnerInfo.getPhase());
528
+            cell = row.createCell(1);
529
+            cell.setCellValue(buildingOwnerInfo.getBuilding());
530
+            cell = row.createCell(2);
531
+            cell.setCellValue(buildingOwnerInfo.getUnit());
532
+            cell = row.createCell(3);
533
+            cell.setCellValue(buildingOwnerInfo.getLevel());
534
+            cell = row.createCell(4);
535
+            cell.setCellValue(buildingOwnerInfo.getRoomNo());
536
+            cell = row.createCell(5);
537
+            cell.setCellValue(buildingOwnerInfo.getOwnerName());
538
+            currentRow ++;
539
+            index ++;
540
+            if (index == records.size()) {
541
+                index = 0;
542
+                page = new Page(infoIPage.getCurrent() + 1,pageSize);
543
+                infoIPage = tpBuildingOwnerInfoMapper.selectPage(page, buildingOwnerInfoQueryWrapper);
544
+                records = infoIPage.getRecords();
525
             }
545
             }
526
-        }
546
+        } while (infoIPage.getCurrent() <= pages);
527
 
547
 
528
         responseBean.addSuccess(workbook);
548
         responseBean.addSuccess(workbook);
529
         return responseBean;
549
         return responseBean;

+ 32
- 10
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java 查看文件

4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
5
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
8
 import com.baomidou.mybatisplus.core.toolkit.Constants;
7
 import com.baomidou.mybatisplus.core.toolkit.Constants;
9
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
8
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
10
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
15
 import com.community.commom.utils.AccountValidatorUtil;
14
 import com.community.commom.utils.AccountValidatorUtil;
16
 import com.community.commom.utils.BeanTools;
15
 import com.community.commom.utils.BeanTools;
17
 
16
 
18
-import com.community.huiju.dao.TaSysUserRoleMapper;
19
-import com.community.huiju.dao.TaUserMapper;
20
-import com.community.huiju.dao.UserMapper;
17
+import com.community.huiju.dao.*;
21
 import com.community.huiju.exception.WisdomException;
18
 import com.community.huiju.exception.WisdomException;
22
-import com.community.huiju.model.TaSysUserRole;
23
-import com.community.huiju.model.TaUser;
19
+import com.community.huiju.model.*;
24
 
20
 
25
-import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
26
-import com.community.huiju.model.TpBuildingOwnerInfo;
27
-
28
-import com.community.huiju.model.User;
21
+import com.community.huiju.service.IBillInvoiceService;
29
 import com.community.huiju.service.IBuildingOwnerInfoService;
22
 import com.community.huiju.service.IBuildingOwnerInfoService;
30
 import com.community.huiju.service.ITaUserService;
23
 import com.community.huiju.service.ITaUserService;
31
 import com.google.common.collect.Lists;
24
 import com.google.common.collect.Lists;
32
 import com.google.common.collect.Maps;
25
 import com.google.common.collect.Maps;
26
+import org.apache.commons.collections.CollectionUtils;
33
 import org.apache.ibatis.binding.MapperMethod;
27
 import org.apache.ibatis.binding.MapperMethod;
34
 import org.apache.ibatis.session.SqlSession;
28
 import org.apache.ibatis.session.SqlSession;
35
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
29
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
78
 
72
 
79
     @Autowired
73
     @Autowired
80
     private ITaUserService iTaUserService;
74
     private ITaUserService iTaUserService;
75
+
76
+    @Autowired
77
+    private BillInvoiceMapper billInvoiceMapper;
78
+
79
+    @Autowired
80
+    private IBillInvoiceService iBillInvoiceService;
81
     
81
     
82
     public static final Logger logger = LoggerFactory.getLogger(BuildingOwnerInfoServiceImpl.class);
82
     public static final Logger logger = LoggerFactory.getLogger(BuildingOwnerInfoServiceImpl.class);
83
     
83
     
232
 
232
 
233
             // 更新APP端用户的角色身份为 业主
233
             // 更新APP端用户的角色身份为 业主
234
             updateAppRole(tpBuildingOwnerInfo.getCommunityId(), appOwnerUser.getId(), Constant.OWNER_ID);
234
             updateAppRole(tpBuildingOwnerInfo.getCommunityId(), appOwnerUser.getId(), Constant.OWNER_ID);
235
+
236
+            // 绑定 缴费单
237
+            bingBillInvoice(user.getId(), tpBuildingOwnerInfo.getId());
235
         }
238
         }
236
 
239
 
237
 
240
 
321
 
324
 
322
             // 更新APP端用户的角色身份为 业主
325
             // 更新APP端用户的角色身份为 业主
323
             updateAppRole(tpBuildingOwnerInfo.getCommunityId(), appOwnerUser.getId(), Constant.OWNER_ID);
326
             updateAppRole(tpBuildingOwnerInfo.getCommunityId(), appOwnerUser.getId(), Constant.OWNER_ID);
327
+
328
+            // 绑定 缴费单
329
+            bingBillInvoice(user.getId(), tpBuildingOwnerInfo.getId());
330
+
324
         }
331
         }
325
 
332
 
326
 
333
 
349
         taSysUserRoleMapper.insert(taSysUserRole);
356
         taSysUserRoleMapper.insert(taSysUserRole);
350
     }
357
     }
351
 
358
 
359
+    /**
360
+     * 绑定 缴费单
361
+     * @param taUserId
362
+     */
363
+    private void bingBillInvoice(Integer taUserId, Integer buildingOwnerInfoId) {
364
+        // 开始绑定缴费单
365
+        QueryWrapper<BillInvoice> queryWrapper = new QueryWrapper<>();
366
+        queryWrapper.eq("building_owner_info_id", buildingOwnerInfoId);
367
+        List<BillInvoice> tpBillInvoices = billInvoiceMapper.selectList(queryWrapper);
368
+        if (CollectionUtils.isNotEmpty(tpBillInvoices)) {
369
+            tpBillInvoices.forEach(e -> e.setTaUserId(taUserId));
370
+            iBillInvoiceService.updateBatchById(tpBillInvoices);
371
+        }
372
+    }
373
+
352
     @Override
374
     @Override
353
     public ResponseBean getBuildingOrUnitOrNumber(String parameter,Integer communityId) {
375
     public ResponseBean getBuildingOrUnitOrNumber(String parameter,Integer communityId) {
354
 
376
 

二進制
CODE/smart-community/property-api/src/main/resources/缴费单模板.xls 查看文件


+ 8
- 0
VUECODE/smart-property-manage/src/api/bill.js 查看文件

47
   })
47
   })
48
 }
48
 }
49
 
49
 
50
+// 下载excel模板
51
+export function billDownloadExcel() {
52
+  return request({
53
+    url: '/bill/downloadExcel',
54
+    method: 'get',
55
+    responseType: 'blob'
56
+  })
57
+}

+ 3
- 3
VUECODE/smart-property-manage/src/router/index.js 查看文件

221
         meta: { title: '收费组管理', icon: 'table' }
221
         meta: { title: '收费组管理', icon: 'table' }
222
       },
222
       },
223
       {
223
       {
224
-        path: '/bill/management/info/:id',
224
+        path: '/bill/management/info',
225
         component: () => import('@/views/bill/info/index'),
225
         component: () => import('@/views/bill/info/index'),
226
         name: 'bill-info',
226
         name: 'bill-info',
227
         hidden: true,
227
         hidden: true,
235
         meta: { title: '新增收费组', icon: 'table' }
235
         meta: { title: '新增收费组', icon: 'table' }
236
       },
236
       },
237
       {
237
       {
238
-        path: '/bill/management/edi/:id',
238
+        path: '/bill/management/edi',
239
         component: () => import('@/views/bill/edi/index'),
239
         component: () => import('@/views/bill/edi/index'),
240
         name: 'bill-edi',
240
         name: 'bill-edi',
241
         hidden: true,
241
         hidden: true,
242
         meta: { title: '修改收费组', icon: 'table' }
242
         meta: { title: '修改收费组', icon: 'table' }
243
       },
243
       },
244
       {
244
       {
245
-        path: '/bill/management/info/bill-edi/:id',
245
+        path: '/bill/management/info/bill-edi',
246
         component: () => import('@/views/bill/info/bill-edi/index'),
246
         component: () => import('@/views/bill/info/bill-edi/index'),
247
         name: 'bill-info-edi',
247
         name: 'bill-info-edi',
248
         hidden: true,
248
         hidden: true,

+ 10
- 1
VUECODE/smart-property-manage/src/store/modules/bill.js 查看文件

1
-import { fetchBillList, billUploadExcelAdd, updateBillStatus, deleteBillBeach } from '@/api/bill'
1
+import { fetchBillList, billUploadExcelAdd, updateBillStatus, deleteBillBeach, billDownloadExcel } from '@/api/bill'
2
 
2
 
3
 const transaction = {
3
 const transaction = {
4
   namespaced: true,
4
   namespaced: true,
56
           reject(error)
56
           reject(error)
57
         })
57
         })
58
       })
58
       })
59
+    },
60
+    BillDownloadExcel({ commit }) { // 下载Excel模板
61
+      return new Promise((resolve, reject) => {
62
+        billDownloadExcel().then(response => {
63
+          resolve(response)
64
+        }).catch(error => {
65
+          reject(error)
66
+        })
67
+      })
59
     }
68
     }
60
   }
69
   }
61
 }
70
 }

+ 14
- 1
VUECODE/smart-property-manage/src/views/bill/add/index.vue 查看文件

29
             <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
29
             <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
30
           </el-upload>
30
           </el-upload>
31
           如果还未制作账单,请先下载账单模板,按规则填写费用后再上传
31
           如果还未制作账单,请先下载账单模板,按规则填写费用后再上传
32
-          <el-button type="primary" size="small" icon="el-icon-download" @click="submitForm('ruleForm')">下载模板</el-button>
32
+          <el-button type="primary" size="small" icon="el-icon-download" @click="downloadExcel">下载模板</el-button>
33
         </span>
33
         </span>
34
       </div>
34
       </div>
35
       <span style="color: #99a9bf; font-size: 13px;">如果想修改下表的内容,请重新下载excel模板填写金额后上传,系统会直接删除下表所有旧数据,以新的excel内容为准</span>
35
       <span style="color: #99a9bf; font-size: 13px;">如果想修改下表的内容,请重新下载excel模板填写金额后上传,系统会直接删除下表所有旧数据,以新的excel内容为准</span>
296
         str += obj.roomNo
296
         str += obj.roomNo
297
       }
297
       }
298
       return str
298
       return str
299
+    },
300
+    downloadExcel() {
301
+      this.$store.dispatch('bill/BillDownloadExcel').then(res => {
302
+        const url = window.URL.createObjectURL(new Blob([res]))
303
+        const link = document.createElement('a')
304
+        link.style.display = 'none'
305
+        link.href = url
306
+        link.setAttribute('download', '缴费单模板.xls')
307
+        document.body.appendChild(link)
308
+        link.click()
309
+      }).catch(() => {
310
+        console.log('error BillDownloadExcel')
311
+      })
299
     }
312
     }
300
   }
313
   }
301
 }
314
 }

+ 15
- 2
VUECODE/smart-property-manage/src/views/bill/edi/index.vue 查看文件

29
             <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
29
             <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
30
           </el-upload>
30
           </el-upload>
31
           如果还未制作账单,请先下载账单模板,按规则填写费用后再上传
31
           如果还未制作账单,请先下载账单模板,按规则填写费用后再上传
32
-          <el-button type="primary" size="small" icon="el-icon-download" @click="submitForm('ruleForm')">下载模板</el-button>
32
+          <el-button type="primary" size="small" icon="el-icon-download" @click="downloadExcel">下载模板</el-button>
33
         </span>
33
         </span>
34
       </div>
34
       </div>
35
       <el-table
35
       <el-table
130
     }
130
     }
131
   },
131
   },
132
   created() {
132
   created() {
133
-    this.listQuery.billId = this.$route.params.id
133
+    this.listQuery.billId = this.$route.query.id
134
     this.billInvoiceGetInvoiceInvalid()
134
     this.billInvoiceGetInvoiceInvalid()
135
     // this.getMenuList()
135
     // this.getMenuList()
136
   },
136
   },
323
         str += obj.roomNo
323
         str += obj.roomNo
324
       }
324
       }
325
       return str
325
       return str
326
+    },
327
+    downloadExcel() {
328
+      this.$store.dispatch('bill/BillDownloadExcel').then(res => {
329
+        const url = window.URL.createObjectURL(new Blob([res]))
330
+        const link = document.createElement('a')
331
+        link.style.display = 'none'
332
+        link.href = url
333
+        link.setAttribute('download', '缴费单模板.xls')
334
+        document.body.appendChild(link)
335
+        link.click()
336
+      }).catch(() => {
337
+        console.log('error BillDownloadExcel')
338
+      })
326
     }
339
     }
327
   }
340
   }
328
 }
341
 }

+ 2
- 2
VUECODE/smart-property-manage/src/views/bill/index.vue 查看文件

162
     },
162
     },
163
     getInfo(billId, billStatus) {
163
     getInfo(billId, billStatus) {
164
       if (billStatus === '2') {
164
       if (billStatus === '2') {
165
-        this.$router.push({ name: 'bill-edi', params: { id: billId }})
165
+        this.$router.push({ name: 'bill-edi', query: { id: billId }})
166
       } else {
166
       } else {
167
-        this.$router.push({ name: 'bill-info', params: { id: billId }})
167
+        this.$router.push({ name: 'bill-info', query: { id: billId }})
168
       }
168
       }
169
     },
169
     },
170
     addBill() {
170
     addBill() {

+ 1
- 1
VUECODE/smart-property-manage/src/views/bill/info/add/index.vue 查看文件

116
   mounted() {
116
   mounted() {
117
     // 获取期
117
     // 获取期
118
     this.getPhase()
118
     this.getPhase()
119
-    this.formInline.billId = this.$route.params.id
119
+    this.formInline.billId = this.$route.query.id
120
     // 查询数据
120
     // 查询数据
121
     this.getTempBillInvoice()
121
     this.getTempBillInvoice()
122
   },
122
   },

+ 1
- 1
VUECODE/smart-property-manage/src/views/bill/info/bill-edi/index.vue 查看文件

45
     }
45
     }
46
   },
46
   },
47
   mounted() {
47
   mounted() {
48
-    this.ruleForm.id = this.$route.params.id
48
+    this.ruleForm.id = this.$route.query.id
49
     this.getBillByIdInfo()
49
     this.getBillByIdInfo()
50
   },
50
   },
51
   methods: {
51
   methods: {

+ 17
- 15
VUECODE/smart-property-manage/src/views/bill/info/index.vue 查看文件

206
   mounted() {
206
   mounted() {
207
     // 获取期
207
     // 获取期
208
     this.getPhase()
208
     this.getPhase()
209
-    this.formInline.billId = this.$route.params.id
209
+    this.formInline.billId = this.$route.query.id
210
     this.getBillInvoice()
210
     this.getBillInvoice()
211
   },
211
   },
212
   methods: {
212
   methods: {
345
       this.getBillInvoice()
345
       this.getBillInvoice()
346
     },
346
     },
347
     updateBill() { // 跳转修改bill标题页面 bill-info-edi
347
     updateBill() { // 跳转修改bill标题页面 bill-info-edi
348
-      this.$router.push({ name: 'bill-info-edi', params: { id: this.formInline.billId }})
348
+      this.$router.push({ name: 'bill-info-edi', query: { id: this.formInline.billId }})
349
     },
349
     },
350
     deleteBeachIds() { // 批量删除
350
     deleteBeachIds() { // 批量删除
351
       if (this.deleteIds.length <= 0) {
351
       if (this.deleteIds.length <= 0) {
434
     },
434
     },
435
     addBillInvoice() {
435
     addBillInvoice() {
436
       // 如果是 收费已完成 的收费项, 则不允许跳进添加页面
436
       // 如果是 收费已完成 的收费项, 则不允许跳进添加页面
437
-      this.$store.dispatch('GetBillByIdInfo', this.formInline.billId).then(res => {
438
-        const resCode = res.code
439
-        if (resCode === '0') {
440
-          const billStatus = res.data.billStatus
441
-          if (billStatus === '1') {
442
-            this.$message.error('不能给收费已完成的收费组添加收费单!')
443
-            return
444
-          }
445
-          this.$router.push({ name: 'bill-info-add', params: { id: this.formInline.billId }})
446
-        }
447
-      }).catch(() => {
448
-        console.log('GetBillByIdInfo error')
449
-      })
437
+      // this.$store.dispatch('GetBillByIdInfo', this.formInline.billId).then(res => {
438
+      //   const resCode = res.code
439
+      //   if (resCode === '0') {
440
+      //     const billStatus = res.data.billStatus
441
+      //     if (billStatus === '1') {
442
+      //       this.$message.error('不能给收费已完成的收费组添加收费单!')
443
+      //       return
444
+      //     }
445
+      //     this.$router.push({ name: 'bill-info-add', params: { id: this.formInline.billId }})
446
+      //   }
447
+      // }).catch(() => {
448
+      //   console.log('GetBillByIdInfo error')
449
+      // })
450
+
451
+      this.$router.push({ name: 'bill-info-add', query: { id: this.formInline.billId }})
450
     },
452
     },
451
     showPayPrice(payPrice) { //  转换金额
453
     showPayPrice(payPrice) { //  转换金额
452
       const price = payPrice / 100
454
       const price = payPrice / 100