张延森 il y a 4 ans
Parent
révision
ad1599163a

+ 0
- 2
src/main/java/com/huiju/estateagents/EstateagentsApplication.java Voir le fichier

1
 package com.huiju.estateagents;
1
 package com.huiju.estateagents;
2
 
2
 
3
-import com.huiju.estateagents.websocket.ChatServer;
4
 import org.springframework.boot.SpringApplication;
3
 import org.springframework.boot.SpringApplication;
5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6
 import org.springframework.context.ConfigurableApplicationContext;
5
 import org.springframework.context.ConfigurableApplicationContext;
15
 	public static void main(String[] args) {
14
 	public static void main(String[] args) {
16
 		SpringApplication springApplication = new SpringApplication(EstateagentsApplication.class);
15
 		SpringApplication springApplication = new SpringApplication(EstateagentsApplication.class);
17
 		ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
16
 		ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
18
-//		ChatServer.setApplicationContext(configurableApplicationContext);
19
 	}
17
 	}
20
 
18
 
21
 }
19
 }

+ 10
- 0
src/main/java/com/huiju/estateagents/common/DateUtils.java Voir le fichier

6
 import java.time.ZoneId;
6
 import java.time.ZoneId;
7
 import java.time.format.DateTimeFormatter;
7
 import java.time.format.DateTimeFormatter;
8
 import java.util.Date;
8
 import java.util.Date;
9
+import java.util.Locale;
9
 
10
 
10
 public class DateUtils {
11
 public class DateUtils {
11
     public static LocalDateTime date2LocalDateTime(Date date) {
12
     public static LocalDateTime date2LocalDateTime(Date date) {
123
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
124
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
124
         return LocalDateTime.parse(target, df);
125
         return LocalDateTime.parse(target, df);
125
     }
126
     }
127
+
128
+    public static LocalDateTime parse(String str, String format) {
129
+        if (null == str || "".equals(str) || "null".equals(str) || "undefined".equals(str)) {
130
+            return null;
131
+        }
132
+
133
+        DateTimeFormatter df = DateTimeFormatter.ofPattern(format, Locale.CHINA);
134
+        return LocalDateTime.parse(str, df);
135
+    }
126
 }
136
 }

+ 22
- 19
src/main/java/com/huiju/estateagents/property/controller/BillController.java Voir le fichier

4
 import com.huiju.estateagents.base.BaseController;
4
 import com.huiju.estateagents.base.BaseController;
5
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.base.ResponseBean;
6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
6
 import com.huiju.estateagents.center.taUser.entity.TaUser;
7
-import com.huiju.estateagents.property.common.UserElement;
7
+import com.huiju.estateagents.common.DateUtils;
8
+import com.huiju.estateagents.common.StringUtils;
8
 import com.huiju.estateagents.property.model.Bill;
9
 import com.huiju.estateagents.property.model.Bill;
9
 import com.huiju.estateagents.property.service.IBillService;
10
 import com.huiju.estateagents.property.service.IBillService;
10
 import io.swagger.annotations.Api;
11
 import io.swagger.annotations.Api;
20
 import javax.servlet.http.HttpServletResponse;
21
 import javax.servlet.http.HttpServletResponse;
21
 import javax.servlet.http.HttpSession;
22
 import javax.servlet.http.HttpSession;
22
 import java.io.OutputStream;
23
 import java.io.OutputStream;
23
-import java.text.ParseException;
24
-import java.text.SimpleDateFormat;
25
-import java.util.Date;
24
+import java.time.LocalDateTime;
26
 import java.util.List;
25
 import java.util.List;
27
 import java.util.Map;
26
 import java.util.Map;
28
 
27
 
52
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
51
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
53
     })
52
     })
54
     @RequestMapping(value = "/admin/bills",method = RequestMethod.GET)
53
     @RequestMapping(value = "/admin/bills",method = RequestMethod.GET)
55
-    public ResponseBean getList(@RequestParam(value = "billId", required = false) Integer billId,
54
+    public ResponseBean getList(@RequestParam("communityId") Integer communityId,
55
+                                @RequestParam(value = "billId", required = false) Integer billId,
56
                                 @RequestParam(value = "billName", required = false) String billName,
56
                                 @RequestParam(value = "billName", required = false) String billName,
57
-                                @RequestParam(value = "billExplain", required = false) String billExplain,
57
+                                @RequestParam(value = "startDate", required = false) String startDate,
58
+                                @RequestParam(value = "endDate", required = false) String endDate,
59
+                                @RequestParam(value = "isTicket", required = false) Boolean isTicket,
58
                                 @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
60
                                 @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
59
                                 @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize, HttpServletRequest request){
61
                                 @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize, HttpServletRequest request){
60
         ResponseBean responseBean = new ResponseBean();
62
         ResponseBean responseBean = new ResponseBean();
61
         TaUser userElement = getTaUser(request);
63
         TaUser userElement = getTaUser(request);
62
         Bill bill = new Bill();
64
         Bill bill = new Bill();
63
         bill.setId(billId);
65
         bill.setId(billId);
66
+        bill.setCommunityId(communityId);
64
         bill.setBillName(billName);
67
         bill.setBillName(billName);
65
-        bill.setBillExplain(billExplain);
68
+        bill.setIsTicket(isTicket);
69
+        bill.setStartDate(!StringUtils.isEmpty(startDate) ? DateUtils.parse(startDate + " 00:00:00", "yyyy-MM-dd HH:mm:ss") : null);
70
+        bill.setEndDate(!StringUtils.isEmpty(startDate) ? DateUtils.parse(endDate + " 23:59:59", "yyyy-MM-dd HH:mm:ss") : null);
66
         bill.setOrgId(userElement.getOrgId());
71
         bill.setOrgId(userElement.getOrgId());
67
         responseBean = iBillService.getBillList(bill,pageNum,pageSize);
72
         responseBean = iBillService.getBillList(bill,pageNum,pageSize);
68
         return responseBean;
73
         return responseBean;
91
     // @ApiOperation(value = "上传缴费项接口, 保存/修改", notes = "上传缴费项接口, 保存/修改")
96
     // @ApiOperation(value = "上传缴费项接口, 保存/修改", notes = "上传缴费项接口, 保存/修改")
92
     @PostMapping(value = "/admin/bill/uploadExcel/add", consumes = "multipart/*", headers = "content-type=multipart/form-data")
97
     @PostMapping(value = "/admin/bill/uploadExcel/add", consumes = "multipart/*", headers = "content-type=multipart/form-data")
93
     public ResponseBean addUploadExcel(HttpServletRequest request,
98
     public ResponseBean addUploadExcel(HttpServletRequest request,
99
+                                       @RequestParam("communityId") Integer communityId,
94
                                        @RequestParam(value = "billId", required = false) Integer billId,
100
                                        @RequestParam(value = "billId", required = false) Integer billId,
95
                                        @RequestParam(value = "file", required = false) MultipartFile file,
101
                                        @RequestParam(value = "file", required = false) MultipartFile file,
96
-                                       @RequestParam("billExplain") String billExplain,
102
+//                                       @RequestParam("billExplain") String billExplain,
97
                                        @RequestParam("billName") String billName,
103
                                        @RequestParam("billName") String billName,
98
-                                       @RequestParam("endDate") Date endDate,
104
+                                       @RequestParam("startDate") String startDate,
105
+                                       @RequestParam("endDate") String endDate,
99
                                        @RequestParam("billStatus") String billStatus) {
106
                                        @RequestParam("billStatus") String billStatus) {
100
         ResponseBean responseBean = new ResponseBean();
107
         ResponseBean responseBean = new ResponseBean();
101
         TaUser userElement = getTaUser(request);
108
         TaUser userElement = getTaUser(request);
102
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
103
-//        Date date = null;
104
-//        try {
105
-//            String d = simpleDateFormat.format(new Long(endDate));
106
-//            date = simpleDateFormat.parse(d);
107
-//        } catch (ParseException e) {
108
-//            e.printStackTrace();
109
-//        }
110
-        responseBean = iBillService.getExcelData(billId, file, billExplain, billName, endDate, billStatus, userElement);
109
+
110
+        LocalDateTime stDate = DateUtils.parse(startDate + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
111
+        LocalDateTime edDate = DateUtils.parse(endDate + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
112
+
113
+        responseBean = iBillService.saveExcelData(billId, file, communityId, billName, stDate, edDate, billStatus, userElement);
111
         return responseBean;
114
         return responseBean;
112
     }
115
     }
113
 
116
 
149
 
152
 
150
     })
153
     })
151
     @RequestMapping(value = "/admin/bill/downloadExcel", method = RequestMethod.GET)
154
     @RequestMapping(value = "/admin/bill/downloadExcel", method = RequestMethod.GET)
152
-    public void exportExcel(@RequestParam(value = "phaseId") Integer communityId,
155
+    public void exportExcel(@RequestParam(value = "communityId") Integer communityId,
153
                             @RequestParam(value = "phaseId",required = false) String phaseId,
156
                             @RequestParam(value = "phaseId",required = false) String phaseId,
154
                             @RequestParam(value = "buildingId",required = false) String buildingId,
157
                             @RequestParam(value = "buildingId",required = false) String buildingId,
155
                             HttpServletResponse response, HttpServletRequest request) {
158
                             HttpServletResponse response, HttpServletRequest request) {

+ 3
- 2
src/main/java/com/huiju/estateagents/property/controller/BillInvoiceController.java Voir le fichier

6
 import com.huiju.estateagents.base.ResponseBean;
6
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.center.taUser.entity.TaUser;
7
 import com.huiju.estateagents.center.taUser.entity.TaUser;
8
 import com.huiju.estateagents.property.common.UserElement;
8
 import com.huiju.estateagents.property.common.UserElement;
9
+import com.huiju.estateagents.property.model.Bill;
9
 import com.huiju.estateagents.property.model.BillInvoice;
10
 import com.huiju.estateagents.property.model.BillInvoice;
10
 import com.huiju.estateagents.property.service.IBillInvoiceService;
11
 import com.huiju.estateagents.property.service.IBillInvoiceService;
11
 import com.huiju.estateagents.property.service.IBillService;
12
 import com.huiju.estateagents.property.service.IBillService;
64
 
65
 
65
     })
66
     })
66
     @RequestMapping(value = "/admin/bill/invoice/updateBill", method = RequestMethod.PUT)
67
     @RequestMapping(value = "/admin/bill/invoice/updateBill", method = RequestMethod.PUT)
67
-    public ResponseBean updateBill(HttpServletRequest request, @RequestBody String parameter) {
68
+    public ResponseBean updateBill(HttpServletRequest request, @RequestBody Bill bill) {
68
         ResponseBean responseBean = new ResponseBean();
69
         ResponseBean responseBean = new ResponseBean();
69
 
70
 
70
         TaUser userElement = getTaUser(request);
71
         TaUser userElement = getTaUser(request);
71
-        responseBean = iBillService.updateBillNameAndBillExplainAndEndDate(userElement, parameter);
72
+        responseBean = iBillService.updateBillNameAndBillExplainAndEndDate(userElement, bill);
72
         return responseBean;
73
         return responseBean;
73
     }
74
     }
74
 
75
 

+ 47
- 0
src/main/java/com/huiju/estateagents/property/entity/TpBillType.java Voir le fichier

1
+package com.huiju.estateagents.property.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-01-19
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TpBillType 对象", description="")
26
+public class TpBillType implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "ID")
31
+    @TableId(value = "id", type = IdType.AUTO)
32
+    private Integer id;
33
+
34
+    @ApiModelProperty(value = "名称")
35
+    private String name;
36
+
37
+    @ApiModelProperty(value = "状态")
38
+    private Integer status;
39
+
40
+    @ApiModelProperty(value = "创建时间")
41
+    private LocalDateTime createDate;
42
+
43
+    @ApiModelProperty(value = "所属机构")
44
+    private Integer orgId;
45
+
46
+
47
+}

+ 17
- 0
src/main/java/com/huiju/estateagents/property/mapper/TpBillTypeMapper.java Voir le fichier

1
+package com.huiju.estateagents.property.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.huiju.estateagents.property.entity.TpBillType;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ *  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2021-01-19
14
+ */
15
+@Mapper
16
+public interface TpBillTypeMapper extends BaseMapper<TpBillType> {
17
+}

+ 14
- 1
src/main/java/com/huiju/estateagents/property/model/Bill.java Voir le fichier

8
 import lombok.experimental.Accessors;
8
 import lombok.experimental.Accessors;
9
 
9
 
10
 import java.io.Serializable;
10
 import java.io.Serializable;
11
+import java.time.LocalDateTime;
11
 import java.util.Date;
12
 import java.util.Date;
12
 
13
 
13
 /**
14
 /**
32
     /**
33
     /**
33
      * 小区id
34
      * 小区id
34
      */
35
      */
36
+    private Integer communityId;
37
+
35
     private Integer orgId;
38
     private Integer orgId;
36
 
39
 
37
     /**
40
     /**
66
      */
69
      */
67
     private String billStatus;
70
     private String billStatus;
68
 
71
 
72
+    private LocalDateTime startDate;
73
+
69
     /**
74
     /**
70
      * 截止时间
75
      * 截止时间
71
      */
76
      */
72
-    private Date endDate;
77
+    private LocalDateTime endDate;
73
 
78
 
74
     /**
79
     /**
75
      * 创建人
80
      * 创建人
91
      */
96
      */
92
     private Date updateDate;
97
     private Date updateDate;
93
 
98
 
99
+    /**
100
+     * 收费类型
101
+     */
102
+    private Integer typeId;
94
 
103
 
104
+    /**
105
+     * 是否工单费用
106
+     */
107
+    private Boolean isTicket;
95
 }
108
 }

+ 6
- 3
src/main/java/com/huiju/estateagents/property/model/BillInvoice.java Voir le fichier

30
     @TableId(value = "id", type = IdType.AUTO)
30
     @TableId(value = "id", type = IdType.AUTO)
31
     private Integer id;
31
     private Integer id;
32
 
32
 
33
-    /**
34
-     * 小区id
35
-     */
36
     private Integer orgId;
33
     private Integer orgId;
37
 
34
 
38
     /**
35
     /**
129
     @TableField(exist = false)
126
     @TableField(exist = false)
130
     private String ownerName;
127
     private String ownerName;
131
 
128
 
129
+    /**
130
+     * 小区
131
+     */
132
+    @TableField(exist = false)
133
+    private Integer communityId;
134
+
132
     /**
135
     /**
133
      * 期
136
      * 期
134
      */
137
      */

+ 4
- 5
src/main/java/com/huiju/estateagents/property/service/IBillService.java Voir le fichier

3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.center.taUser.entity.TaUser;
5
 import com.huiju.estateagents.center.taUser.entity.TaUser;
6
-import com.huiju.estateagents.property.common.UserElement;
7
 import com.huiju.estateagents.property.model.Bill;
6
 import com.huiju.estateagents.property.model.Bill;
8
 import org.springframework.web.multipart.MultipartFile;
7
 import org.springframework.web.multipart.MultipartFile;
9
 
8
 
10
-import java.util.Date;
9
+import java.time.LocalDateTime;
11
 import java.util.List;
10
 import java.util.List;
12
 import java.util.Map;
11
 import java.util.Map;
13
 
12
 
28
      * @param userElement
27
      * @param userElement
29
      * @return
28
      * @return
30
      */
29
      */
31
-    ResponseBean updateBillNameAndBillExplainAndEndDate(TaUser userElement, String parameter);
30
+    ResponseBean updateBillNameAndBillExplainAndEndDate(TaUser userElement, Bill bill);
32
 
31
 
33
     /**
32
     /**
34
      * 根据ID查询 缴费项
33
      * 根据ID查询 缴费项
48
 
47
 
49
 	/**
48
 	/**
50
 	 * 上传excel, 解析, 但不入库
49
 	 * 上传excel, 解析, 但不入库
50
+	 *
51
 	 * @param file
51
 	 * @param file
52
 	 * @return
52
 	 * @return
53
 	 */
53
 	 */
57
 	 * 上传excel, 解析 入库
57
 	 * 上传excel, 解析 入库
58
 	 * @param billId
58
 	 * @param billId
59
 	 * @param file
59
 	 * @param file
60
-	 * @param billExplain
61
 	 * @param billName
60
 	 * @param billName
62
 	 * @param endDate
61
 	 * @param endDate
63
 	 * @param billStatus
62
 	 * @param billStatus
64
 	 * @return
63
 	 * @return
65
 	 */
64
 	 */
66
-	ResponseBean getExcelData(Integer billId, MultipartFile file, String billExplain, String billName, Date endDate, String billStatus, TaUser userElement);
65
+	ResponseBean saveExcelData(Integer billId, MultipartFile file, Integer communityId, String billName, LocalDateTime startDate, LocalDateTime endDate, String billStatus, TaUser userElement);
67
 
66
 
68
 	/**
67
 	/**
69
 	 * 修改 缴费项状态
68
 	 * 修改 缴费项状态

+ 94
- 39
src/main/java/com/huiju/estateagents/property/service/impl/BillInvoiceServiceImpl.java Voir le fichier

8
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.base.ResponseBean;
9
 import com.huiju.estateagents.center.taUser.entity.TaUser;
9
 import com.huiju.estateagents.center.taUser.entity.TaUser;
10
 import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
10
 import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
11
+import com.huiju.estateagents.common.DateUtils;
12
+import com.huiju.estateagents.common.StringUtils;
11
 import com.huiju.estateagents.property.common.UserElement;
13
 import com.huiju.estateagents.property.common.UserElement;
12
 import com.huiju.estateagents.property.dao.*;
14
 import com.huiju.estateagents.property.dao.*;
13
 import com.huiju.estateagents.property.exception.WisdomException;
15
 import com.huiju.estateagents.property.exception.WisdomException;
120
         respMap.put("list", invoiceIPage.getRecords());
122
         respMap.put("list", invoiceIPage.getRecords());
121
         respMap.put("billName", bill.getBillName());
123
         respMap.put("billName", bill.getBillName());
122
         respMap.put("billExplain", bill.getBillExplain());
124
         respMap.put("billExplain", bill.getBillExplain());
125
+        respMap.put("startDate", bill.getStartDate());
123
         respMap.put("endDate", bill.getEndDate());
126
         respMap.put("endDate", bill.getEndDate());
127
+        respMap.put("communityId", bill.getCommunityId());
128
+
124
 
129
 
125
         responseBean.addSuccess(respMap);
130
         responseBean.addSuccess(respMap);
126
 
131
 
262
         JSONObject jsonObject = JSONObject.parseObject(parameter);
267
         JSONObject jsonObject = JSONObject.parseObject(parameter);
263
         // 收费项ID
268
         // 收费项ID
264
         Integer billId = jsonObject.getInteger("billId");
269
         Integer billId = jsonObject.getInteger("billId");
270
+        //
271
+        Integer communityId = jsonObject.getInteger("communityId");
272
+
273
+        if (null == billId || null == communityId) {
274
+            return ResponseBean.error("收费ID或者小区不能为空", ResponseBean.ERROR_MISSING_PARAMS);
275
+        }
276
+
265
         // 区/期
277
         // 区/期
266
         Integer phase = jsonObject.getInteger("phaseId");
278
         Integer phase = jsonObject.getInteger("phaseId");
267
         // 栋
279
         // 栋
290
         // 校验 期/区/栋/单元/楼层/户号
302
         // 校验 期/区/栋/单元/楼层/户号
291
         QueryWrapper<TpRoomNo> roomNoQueryWrapper = new QueryWrapper<>();
303
         QueryWrapper<TpRoomNo> roomNoQueryWrapper = new QueryWrapper<>();
292
         roomNoQueryWrapper.eq("org_id", userElement.getOrgId());
304
         roomNoQueryWrapper.eq("org_id", userElement.getOrgId());
305
+        roomNoQueryWrapper.eq("community_id", communityId);
293
         roomNoQueryWrapper.eq("phase_id", phase);
306
         roomNoQueryWrapper.eq("phase_id", phase);
294
         roomNoQueryWrapper.eq("building_id", building);
307
         roomNoQueryWrapper.eq("building_id", building);
295
         roomNoQueryWrapper.eq("unit_id", unit);
308
         roomNoQueryWrapper.eq("unit_id", unit);
386
         map.put("billId", billId);
399
         map.put("billId", billId);
387
         map.put("orgId", userElement.getOrgId());
400
         map.put("orgId", userElement.getOrgId());
388
 
401
 
402
+        Bill bill = billMapper.selectById(billId);
403
+
389
         List<BillInvoice> billInvoices = billInvoiceMapper.selectBillInvoiceTemp(map);
404
         List<BillInvoice> billInvoices = billInvoiceMapper.selectBillInvoiceTemp(map);
405
+        billInvoices.stream().forEach(e -> e.setCommunityId(bill.getCommunityId()));
390
 
406
 
391
         responseBean.addSuccess(billInvoices);
407
         responseBean.addSuccess(billInvoices);
392
         return responseBean;
408
         return responseBean;
439
     @Override
455
     @Override
440
     public ResponseBean exportExcel(TaUser userElement, Integer billId) {
456
     public ResponseBean exportExcel(TaUser userElement, Integer billId) {
441
         ResponseBean responseBean = new ResponseBean();
457
         ResponseBean responseBean = new ResponseBean();
442
-        String [] title = new String[] { "收费单号","房屋信息","收费单说明","金额(元)","流水","缴费状态","缴费人","缴费时间","新建时间","新建人","修改人","修改时间" };
458
+        String [] title = new String[] {"序号", "收费名称", "开始时间", "结束时间", "类别", "收费单号","期/区","楼栋","单元","房室","金额(元)","订单流水","缴费状态","缴费人","缴费时间" };
443
 
459
 
444
         HSSFWorkbook excel = excel(title, userElement, billId,null);
460
         HSSFWorkbook excel = excel(title, userElement, billId,null);
445
         responseBean.addSuccess(excel);
461
         responseBean.addSuccess(excel);
488
         IPage<BillInvoice> billInvoiceIPage = billInvoiceMapper.selectBillInvoiceEffective(page, map);
504
         IPage<BillInvoice> billInvoiceIPage = billInvoiceMapper.selectBillInvoiceEffective(page, map);
489
         List<BillInvoice> records = billInvoiceIPage.getRecords();
505
         List<BillInvoice> records = billInvoiceIPage.getRecords();
490
 
506
 
507
+        Bill bill = billMapper.selectById(billId);
508
+        if (null == bill) {
509
+            return workbook;
510
+        }
491
 
511
 
492
         // 写入内容
512
         // 写入内容
513
+        int line = 0;
493
         for (int i = 1; i<= billInvoiceIPage.getPages(); i++) {
514
         for (int i = 1; i<= billInvoiceIPage.getPages(); i++) {
494
             for (int t = 0; t<records.size(); t++) {
515
             for (int t = 0; t<records.size(); t++) {
516
+                line ++;
517
+                BillInvoice billInvoice = records.get(t);
495
                 row = sheet.createRow(++rowNum);
518
                 row = sheet.createRow(++rowNum);
496
-                // 收费单号
519
+
520
+                // 序号
497
                 cell = row.createCell(0);
521
                 cell = row.createCell(0);
498
-                cell.setCellValue(records.get(t).getId());
522
+                cell.setCellValue(line);
499
                 cell.setCellStyle(style);
523
                 cell.setCellStyle(style);
500
-                // 房屋信息
524
+
525
+                // 收费名称
501
                 cell = row.createCell(1);
526
                 cell = row.createCell(1);
502
-                cell.setCellValue(records.get(t).getPhase() + records.get(t).getBuilding() + records.get(t).getUnit() + records.get(t).getRoomNo());
527
+                cell.setCellValue(StringUtils.ifNull(billInvoice.getBillInvoiceExplain(), bill.getBillName()));
503
                 cell.setCellStyle(style);
528
                 cell.setCellStyle(style);
504
-                // 业主姓名
505
-//                cell = row.createCell(2);
506
-//                cell.setCellValue(records.get(t).getOwnerName());
507
-//                cell.setCellStyle(style);
508
-                // 收费单说明
529
+
530
+                // 开始时间
509
                 cell = row.createCell(2);
531
                 cell = row.createCell(2);
510
-                cell.setCellValue(records.get(t).getBillInvoiceExplain());
532
+                cell.setCellValue(DateUtils.format(bill.getStartDate(), "yyyy-MM-dd"));
511
                 cell.setCellStyle(style);
533
                 cell.setCellStyle(style);
512
-                // 金额(元)
534
+
535
+                // 结束时间
513
                 cell = row.createCell(3);
536
                 cell = row.createCell(3);
514
-                double price = Double.valueOf(records.get(t).getPayPrice()) / 100.00;
515
-                cell.setCellValue(price);
537
+                cell.setCellValue(DateUtils.format(bill.getEndDate(), "yyyy-MM-dd"));
516
                 cell.setCellStyle(style);
538
                 cell.setCellStyle(style);
517
-                if (null != records.get(t).getBillStatementId()) {
518
-                    // 流水
519
-                    cell = row.createCell(4);
520
-                    cell.setCellValue(records.get(t).getBillStatementId());
521
-                    cell.setCellStyle(style);
522
-                }
523
-                // 缴费状态
539
+
540
+                // 类别
541
+                cell = row.createCell(4);
542
+                cell.setCellValue(bill.getIsTicket() ? "维修" : "物业");
543
+                cell.setCellStyle(style);
544
+
545
+                // 收费单号
524
                 cell = row.createCell(5);
546
                 cell = row.createCell(5);
525
-                cell.setCellValue("0".equals(records.get(t).getBillStatus()) ? "未交费" : "1".equals(records.get(t).getBillStatus()) ? "已线上缴费" : "已线下缴费");
547
+                cell.setCellValue(billInvoice.getId());
526
                 cell.setCellStyle(style);
548
                 cell.setCellStyle(style);
527
-                // 缴费人
549
+
550
+                // 房屋信息
528
                 cell = row.createCell(6);
551
                 cell = row.createCell(6);
529
-                cell.setCellValue(records.get(t).getPayName());
552
+                cell.setCellValue(billInvoice.getPhase());
530
                 cell.setCellStyle(style);
553
                 cell.setCellStyle(style);
531
-                if (null != records.get(t).getPayDate()) {
532
-                    // 缴费时间
533
-                    cell = row.createCell(7);
534
-                    cell.setCellValue(dateFormat.format(records.get(t).getPayDate()));
535
-                    cell.setCellStyle(style);
536
-                }
537
-                // 新建时间
554
+
555
+                cell = row.createCell(7);
556
+                cell.setCellValue(billInvoice.getBuilding());
557
+                cell.setCellStyle(style);
558
+
538
                 cell = row.createCell(8);
559
                 cell = row.createCell(8);
539
-                cell.setCellValue(dateFormat.format(records.get(t).getCreateDate()));
560
+                cell.setCellValue(billInvoice.getUnit());
540
                 cell.setCellStyle(style);
561
                 cell.setCellStyle(style);
541
-                // 新建人
562
+
542
                 cell = row.createCell(9);
563
                 cell = row.createCell(9);
543
-                cell.setCellValue(records.get(t).getCreateUserName());
564
+                cell.setCellValue(billInvoice.getRoomNo());
544
                 cell.setCellStyle(style);
565
                 cell.setCellStyle(style);
545
-                // 修改人
566
+
567
+                // 金额(元)
546
                 cell = row.createCell(10);
568
                 cell = row.createCell(10);
547
-                cell.setCellValue(records.get(t).getUpdateUserName());
569
+                double price = Double.valueOf(billInvoice.getPayPrice()) / 100.00;
570
+                cell.setCellValue(price);
548
                 cell.setCellStyle(style);
571
                 cell.setCellStyle(style);
549
-                if (null != records.get(t).getUpdateDate()) {
550
-                    // 修改时间
572
+                if (null != billInvoice.getBillStatementId()) {
573
+                    // 流水
551
                     cell = row.createCell(11);
574
                     cell = row.createCell(11);
552
-                    cell.setCellValue(dateFormat.format(records.get(t).getUpdateDate()));
575
+                    cell.setCellValue(billInvoice.getBillStatementId());
576
+                    cell.setCellStyle(style);
577
+                }
578
+                // 缴费状态
579
+                cell = row.createCell(12);
580
+                cell.setCellValue("0".equals(billInvoice.getBillStatus()) ? "未交费" : "1".equals(billInvoice.getBillStatus()) ? "已线上缴费" : "已线下缴费");
581
+                cell.setCellStyle(style);
582
+                // 缴费人
583
+                cell = row.createCell(13);
584
+                cell.setCellValue(billInvoice.getPayName());
585
+                cell.setCellStyle(style);
586
+                if (null != billInvoice.getPayDate()) {
587
+                    // 缴费时间
588
+                    cell = row.createCell(14);
589
+                    cell.setCellValue(dateFormat.format(billInvoice.getPayDate()));
553
                     cell.setCellStyle(style);
590
                     cell.setCellStyle(style);
554
                 }
591
                 }
592
+//                // 新建时间
593
+//                cell = row.createCell(8);
594
+//                cell.setCellValue(dateFormat.format(billInvoice.getCreateDate()));
595
+//                cell.setCellStyle(style);
596
+//                // 新建人
597
+//                cell = row.createCell(9);
598
+//                cell.setCellValue(billInvoice.getCreateUserName());
599
+//                cell.setCellStyle(style);
600
+//                // 修改人
601
+//                cell = row.createCell(10);
602
+//                cell.setCellValue(billInvoice.getUpdateUserName());
603
+//                cell.setCellStyle(style);
604
+//                if (null != billInvoice.getUpdateDate()) {
605
+//                    // 修改时间
606
+//                    cell = row.createCell(11);
607
+//                    cell.setCellValue(dateFormat.format(billInvoice.getUpdateDate()));
608
+//                    cell.setCellStyle(style);
609
+//                }
555
             }
610
             }
556
             page.setCurrent(i);
611
             page.setCurrent(i);
557
             page.setSize(500);
612
             page.setSize(500);

+ 26
- 38
src/main/java/com/huiju/estateagents/property/service/impl/BillServiceImpl.java Voir le fichier

1
 package com.huiju.estateagents.property.service.impl;
1
 package com.huiju.estateagents.property.service.impl;
2
 
2
 
3
-import com.alibaba.fastjson.JSONObject;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
38
 
37
 
39
 import java.io.IOException;
38
 import java.io.IOException;
40
 import java.io.InputStream;
39
 import java.io.InputStream;
41
-import java.text.ParseException;
42
 import java.text.SimpleDateFormat;
40
 import java.text.SimpleDateFormat;
43
 import java.time.LocalDateTime;
41
 import java.time.LocalDateTime;
44
 import java.util.Date;
42
 import java.util.Date;
106
 
104
 
107
     @Override
105
     @Override
108
     @Transactional(rollbackFor = Exception.class)
106
     @Transactional(rollbackFor = Exception.class)
109
-    public ResponseBean updateBillNameAndBillExplainAndEndDate(TaUser userElement, String parameter) {
107
+    public ResponseBean updateBillNameAndBillExplainAndEndDate(TaUser userElement, Bill bill) {
110
         ResponseBean responseBean = new ResponseBean();
108
         ResponseBean responseBean = new ResponseBean();
111
-        Bill bill = JSONObject.parseObject(parameter, Bill.class);
109
+//        Bill bill = JSONObject.parseObject(parameter, Bill.class);
112
         if (StringUtils.isEmpty(bill.getBillName())) {
110
         if (StringUtils.isEmpty(bill.getBillName())) {
113
             responseBean.addError("收费项名称不能为空");
111
             responseBean.addError("收费项名称不能为空");
114
             return responseBean;
112
             return responseBean;
115
         }
113
         }
116
-        if (StringUtils.isEmpty(bill.getBillExplain())) {
117
-            responseBean.addError("缴费项说明");
114
+//        if (StringUtils.isEmpty(bill.getBillExplain())) {
115
+//            responseBean.addError("缴费项说明");
116
+//            return responseBean;
117
+//        }
118
+
119
+        if (bill.getStartDate() == null) {
120
+            responseBean.addError("截止时间不能为空");
118
             return responseBean;
121
             return responseBean;
119
         }
122
         }
120
         if (bill.getEndDate() == null) {
123
         if (bill.getEndDate() == null) {
187
 
190
 
188
     @Override
191
     @Override
189
     @Transactional(rollbackFor = Exception.class)
192
     @Transactional(rollbackFor = Exception.class)
190
-    public ResponseBean getExcelData(Integer billId, MultipartFile file, String billExplain, String billName, Date endDate, String billStatus, TaUser userElement) {
193
+    public ResponseBean saveExcelData(Integer billId, MultipartFile file, Integer communityId, String billName, LocalDateTime startDate, LocalDateTime endDate, String billStatus, TaUser userElement) {
191
         ResponseBean responseBean = new ResponseBean();
194
         ResponseBean responseBean = new ResponseBean();
192
 
195
 
193
-        // 获取本地时间
194
-        Date date = new Date();
195
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
196
-        String formatDate = simpleDateFormat.format(date);
197
-        Date parse = null;
198
-        try {
199
-            parse = simpleDateFormat.parse(formatDate);
200
-        } catch (ParseException e) {
201
-            e.printStackTrace();
202
-        }
203
-
204
-        if (endDate.getTime() < parse.getTime()) {
205
-            responseBean.addError("不能小于当前时间!");
206
-            return responseBean;
207
-        }
208
-
209
-
210
         List<BillInvoice> records = null;
196
         List<BillInvoice> records = null;
211
         if (billId != null) {
197
         if (billId != null) {
212
             // 查询出这个收费单, 存在的缴费单数据
198
             // 查询出这个收费单, 存在的缴费单数据
240
 
226
 
241
         // 存入缴费项表
227
         // 存入缴费项表
242
         Bill bill = new Bill();
228
         Bill bill = new Bill();
229
+        bill.setCommunityId(communityId);
243
         bill.setBillName(billName);
230
         bill.setBillName(billName);
244
-        bill.setBillExplain(billExplain);
231
+//        bill.setBillExplain(billExplain);
232
+        bill.setStartDate(startDate);
245
         bill.setEndDate(endDate);
233
         bill.setEndDate(endDate);
246
         if (StringUtils.isNotBlank(strSumDouble)) {
234
         if (StringUtils.isNotBlank(strSumDouble)) {
247
             strSumDouble = strSumDouble.substring(0, strSumDouble.lastIndexOf("."));
235
             strSumDouble = strSumDouble.substring(0, strSumDouble.lastIndexOf("."));
354
                     throw new WisdomException("房产:" + e.getPhase() + e.getBuilding() + e.getUnit() + e.getLevel() + e.getRoomNo() + " 不存在!请核对!");
342
                     throw new WisdomException("房产:" + e.getPhase() + e.getBuilding() + e.getUnit() + e.getLevel() + e.getRoomNo() + " 不存在!请核对!");
355
                 }
343
                 }
356
                 billInvoice.setRoomNoId(tpRoomNo.getId());
344
                 billInvoice.setRoomNoId(tpRoomNo.getId());
357
-                billInvoice.setBillInvoiceExplain(e.getBillExplain());
345
+                billInvoice.setBillInvoiceExplain(billName);
358
                 billInvoice.setPayPrice(e.getPayPrice());
346
                 billInvoice.setPayPrice(e.getPayPrice());
359
                 billInvoice.setBillStatus("0");
347
                 billInvoice.setBillStatus("0");
360
                 billInvoice.setCreateUser(userElement.getUserId());
348
                 billInvoice.setCreateUser(userElement.getUserId());
472
             String roomNo = cell.getStringCellValue().trim();
460
             String roomNo = cell.getStringCellValue().trim();
473
 
461
 
474
 
462
 
475
-            // 收费说明可以为空
476
-            cell = getCell(row.getCell(6));
477
-            String billExplain = null;
478
-            if (null != cell) {
479
-                billExplain = cell.getStringCellValue().trim();
480
-                if (billExplain.length() > 100) {
481
-                    throw new WisdomException("第" + currentRow + "行 收费说明超出100字,请精简到100字以内");
482
-                }
483
-            }
463
+//            // 收费说明可以为空
464
+//            cell = getCell(row.getCell(6));
465
+//            String billExplain = null;
466
+//            if (null != cell) {
467
+//                billExplain = cell.getStringCellValue().trim();
468
+//                if (billExplain.length() > 100) {
469
+//                    throw new WisdomException("第" + currentRow + "行 收费说明超出100字,请精简到100字以内");
470
+//                }
471
+//            }
484
 
472
 
485
-            cell = getCell(row.getCell(7));
473
+            cell = getCell(row.getCell(6));
486
             if (null == cell) {
474
             if (null == cell) {
487
                 throw new WisdomException("第" + currentRow + "行 金额 不能为空");
475
                 throw new WisdomException("第" + currentRow + "行 金额 不能为空");
488
             }
476
             }
496
             temp.setUnit(unit);
484
             temp.setUnit(unit);
497
             temp.setRoomNo(roomNo);
485
             temp.setRoomNo(roomNo);
498
             // temp.setOwnerName(ownerName);
486
             // temp.setOwnerName(ownerName);
499
-            temp.setBillExplain(billExplain);
487
+//            temp.setBillExplain(billExplain);
500
 
488
 
501
 
489
 
502
             if (StringUtils.isNotBlank(money)) {
490
             if (StringUtils.isNotBlank(money)) {
662
                 if (index == records.size()) {
650
                 if (index == records.size()) {
663
                     index = 0;
651
                     index = 0;
664
                     pageNum ++;
652
                     pageNum ++;
665
-                    records = tpRoomNoMapper.selectCommunityIdList(userElement.getOrgId(), communityId, pageNum * pageSize, pageSize);
653
+                    records = tpRoomNoMapper.selectComunityList(userElement.getOrgId(), communityId, phaseId,buildingId, pageNum * pageSize, pageSize);
666
                 }
654
                 }
667
                 if (records.isEmpty()) {
655
                 if (records.isEmpty()) {
668
                     break;
656
                     break;

+ 3
- 1
src/main/java/com/huiju/estateagents/property/service/impl/TpTicketServiceImpl.java Voir le fichier

55
 import java.time.LocalDateTime;
55
 import java.time.LocalDateTime;
56
 import java.time.ZoneId;
56
 import java.time.ZoneId;
57
 import java.time.ZoneOffset;
57
 import java.time.ZoneOffset;
58
+import java.time.temporal.TemporalAdjusters;
58
 import java.util.*;
59
 import java.util.*;
59
 
60
 
60
 /**
61
 /**
1225
         Bill bill = new Bill();
1226
         Bill bill = new Bill();
1226
         bill.setBillName(tpTicket.getTicketTitle());
1227
         bill.setBillName(tpTicket.getTicketTitle());
1227
         bill.setBillExplain(ticket.getPriceExplain());
1228
         bill.setBillExplain(ticket.getPriceExplain());
1228
-        bill.setEndDate(Date.from(LocalDateTime.now().plusMonths(1).atZone( ZoneId.systemDefault()).toInstant()));
1229
+        // 当前时间的下个月初 - 1秒 = 本月月末的最后时间
1230
+        bill.setEndDate(LocalDateTime.now().plusMonths(1).with(TemporalAdjusters.firstDayOfMonth()).minusSeconds(1));
1229
         bill.setPayPrice(ticket.getPrice().toString());
1231
         bill.setPayPrice(ticket.getPrice().toString());
1230
 
1232
 
1231
         bill.setPayedNum(0);
1233
         bill.setPayedNum(0);

+ 16
- 19
src/main/resources/mapper/property/BillMapper.xml Voir le fichier

3
 <mapper namespace="com.huiju.estateagents.property.dao.BillMapper">
3
 <mapper namespace="com.huiju.estateagents.property.dao.BillMapper">
4
     <select id="selectListByParams" resultType="com.huiju.estateagents.property.model.Bill">
4
     <select id="selectListByParams" resultType="com.huiju.estateagents.property.model.Bill">
5
         SELECT
5
         SELECT
6
-            t.id,
7
-            t.org_id,
8
-            t.bill_name,
9
-            t.bill_explain,
10
-            t.pay_total_num,
11
-            t.payed_num,
12
-            t.unpayed_num,
13
-            t.bill_status,
14
-            t.end_date,
15
-            t.create_user,
16
-            t.create_date,
17
-            t.update_user,
18
-            t.update_date
6
+            t.*
19
         FROM
7
         FROM
20
             tp_bill t
8
             tp_bill t
21
         WHERE
9
         WHERE
22
-        1 = 1
23
-        AND t.org_id = #{bill.orgId}
24
-        <if test="bill.id != null and bill.id != '' or bill.id ==0">
25
-            and t.id like concat('%',#{bill.id},'%')
10
+            t.org_id = #{bill.orgId}
11
+            and t.community_id = #{bill.communityId}
12
+        <if test="bill.id != null">
13
+            and t.id = #{bill.id}
26
         </if>
14
         </if>
27
         <if test="bill.billName != null and bill.billName != ''">
15
         <if test="bill.billName != null and bill.billName != ''">
28
             and t.bill_name like concat('%',#{bill.billName,jdbcType=VARCHAR},'%')
16
             and t.bill_name like concat('%',#{bill.billName,jdbcType=VARCHAR},'%')
29
         </if>
17
         </if>
30
-        <if test="bill.billExplain != null and bill.billExplain != ''">
31
-            and t.bill_explain like concat('%',#{bill.billExplain,jdbcType=VARCHAR},'%')
18
+        <if test="bill.startDate != null">
19
+            and t.start_date &gt;= #{bill.startDate}
20
+        </if>
21
+        <if test="bill.endDate != null">
22
+            and t.end_date &lt;= #{bill.endDate}
23
+        </if>
24
+        <if test="bill.isTicket">
25
+            and t.is_ticket = 1
26
+        </if>
27
+        <if test="!bill.isTicket">
28
+            and t.is_ticket = 0
32
         </if>
29
         </if>
33
         order by t.id DESC
30
         order by t.id DESC
34
     </select>
31
     </select>

+ 5
- 0
src/main/resources/mapper/property/TpBillTypeMapper.xml Voir le fichier

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.property.mapper.TpBillTypeMapper">
4
+
5
+</mapper>

BIN
src/main/resources/缴费单模板.xls Voir le fichier


BIN
src/main/resources/缴费单模板.xls.old Voir le fichier