Преглед на файлове

Merge branch 'master' of http://git.ycjcjy.com/xiangsong/xs-service

张延森 преди 4 години
родител
ревизия
78e93e34be

+ 8
- 0
src/main/java/com/huiju/estateagents/property/controller/TpTicketController.java Целия файл

@@ -118,6 +118,14 @@ public class TpTicketController extends BaseController {
118 118
     }
119 119
 
120 120
 
121
+    @RequestMapping(value = "/admin/updateTicketPrice", method = RequestMethod.POST)
122
+    public ResponseBean updateTicketPrice(@RequestBody String parameter, HttpServletRequest request){
123
+        TaUser userElement = getTaUser(request);
124
+        ResponseBean  responseBean = tpTicketService.updateTicketPrice(parameter,userElement.getUserId(),userElement.getOrgId());
125
+        return responseBean;
126
+    }
127
+
128
+
121 129
     @RequestMapping(value = "/wx/ticketList/{orgId}", method = RequestMethod.GET)
122 130
     @ApiOperation(value = "获取 报修/投诉/联系单 各3条数据", notes = "根据 小区编号,第几页,一页多少行")
123 131
     @ApiImplicitParams({

+ 10
- 0
src/main/java/com/huiju/estateagents/property/model/TpTicket.java Целия файл

@@ -98,6 +98,16 @@ public class TpTicket implements Serializable {
98 98
      */
99 99
     private String updateUser;
100 100
 
101
+    /**
102
+     * 工单费用
103
+     */
104
+    private Integer price;
105
+
106
+    /**
107
+     * 缴费单id
108
+     */
109
+    private Integer billInvoiceId;
110
+
101 111
     /**
102 112
      * 用户姓名
103 113
      */

+ 9
- 0
src/main/java/com/huiju/estateagents/property/service/TpTicketService.java Целия файл

@@ -139,4 +139,13 @@ public interface TpTicketService extends IService<TpTicket> {
139 139
      * @return
140 140
      */
141 141
     ResponseBean addWxRecordComment(String parameter, String personId, Integer orgId, String userName);
142
+
143
+    /**
144
+     * 添加工单费用
145
+     * @param parameter
146
+     * @param userId
147
+     * @param orgId
148
+     * @return
149
+     */
150
+    ResponseBean updateTicketPrice(String parameter, Integer userId, Integer orgId);
142 151
 }

+ 67
- 0
src/main/java/com/huiju/estateagents/property/service/impl/TpTicketServiceImpl.java Целия файл

@@ -14,9 +14,11 @@ import com.huiju.estateagents.entity.TaPerson;
14 14
 import com.huiju.estateagents.mapper.TaPersonMapper;
15 15
 import com.huiju.estateagents.property.common.Constant;
16 16
 import com.huiju.estateagents.property.dao.*;
17
+import com.huiju.estateagents.property.exception.WisdomException;
17 18
 import com.huiju.estateagents.property.model.*;
18 19
 import com.huiju.estateagents.property.service.TpTicketService;
19 20
 import com.huiju.estateagents.property.vo.TpTicketVO;
21
+import org.apache.commons.lang3.StringUtils;
20 22
 import org.checkerframework.checker.units.qual.A;
21 23
 import org.springframework.beans.BeanUtils;
22 24
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
26 28
 import java.io.IOException;
27 29
 import java.time.LocalDateTime;
28 30
 import java.time.ZoneId;
31
+import java.time.ZoneOffset;
29 32
 import java.util.*;
30 33
 
31 34
 /**
@@ -62,6 +65,13 @@ public class TpTicketServiceImpl extends ServiceImpl<TpTicketMapper, TpTicket> i
62 65
 
63 66
     @Autowired
64 67
     private TaPersonMapper taPersonMapper;
68
+    /** 缴费项表 **/
69
+    @Autowired
70
+    private BillMapper billMapper;
71
+
72
+    /** 缴费单 **/
73
+    @Autowired
74
+    private BillInvoiceMapper billInvoiceMapper;
65 75
 
66 76
     @Override
67 77
     public ResponseBean ticketLiset(String parameter,Integer orgId) {
@@ -979,4 +989,61 @@ public class TpTicketServiceImpl extends ServiceImpl<TpTicketMapper, TpTicket> i
979 989
         response.addSuccess("成功");
980 990
         return response;
981 991
     }
992
+
993
+    /**
994
+     * 添加工单费用
995
+     *
996
+     * @param parameter
997
+     * @param userId
998
+     * @param orgId
999
+     * @return
1000
+     */
1001
+    @Transactional
1002
+    @Override
1003
+    public ResponseBean updateTicketPrice(String parameter, Integer userId, Integer orgId) {
1004
+        TpTicket ticket = JSONObject.parseObject(parameter, TpTicket.class);
1005
+        TpTicket tpTicket = tpTicketMapper.selectById(ticket.getId());
1006
+
1007
+        // 新建缴费项
1008
+        Bill bill = new Bill();
1009
+        bill.setBillName(tpTicket.getTicketTitle());
1010
+        bill.setBillExplain(tpTicket.getTicketContent());
1011
+        bill.setEndDate(Date.from(LocalDateTime.now().plusMonths(1).atZone( ZoneId.systemDefault()).toInstant()));
1012
+        bill.setPayPrice(ticket.getPrice().toString());
1013
+
1014
+        bill.setPayedNum(0);
1015
+        bill.setBillStatus("0");
1016
+        bill.setCreateDate(new Date());
1017
+        bill.setCreateUser(userId);
1018
+        bill.setOrgId(orgId);
1019
+        bill.setPayTotalNum(ticket.getPrice());
1020
+        bill.setUnpayedNum(ticket.getPrice());
1021
+        billMapper.insert(bill);
1022
+
1023
+        // 新增缴费单
1024
+        BillInvoice billInvoice = new BillInvoice();
1025
+        billInvoice.setOrgId(orgId);
1026
+        billInvoice.setBillId(bill.getId());
1027
+
1028
+        // 获取房间号
1029
+        QueryWrapper<TaUserVerify> taUserVerifyQueryWrapper = new QueryWrapper<>();
1030
+        taUserVerifyQueryWrapper.eq("verify_status","0");
1031
+        taUserVerifyQueryWrapper.eq("person_id",tpTicket.getPersonId());
1032
+        List<TaUserVerify> userVerifyList = taUserVerifyMapper.selectList(taUserVerifyQueryWrapper);
1033
+        billInvoice.setRoomNoId(userVerifyList.get(0).getRoomNoId());
1034
+        billInvoice.setBillInvoiceExplain(bill.getBillExplain());
1035
+        billInvoice.setPayPrice(Integer.valueOf(bill.getPayPrice()));
1036
+        billInvoice.setBillStatus("0");
1037
+        billInvoice.setCreateUser(userId);
1038
+        billInvoice.setCreateDate(new Date());
1039
+        billInvoice.setStatus(1);
1040
+
1041
+        billInvoiceMapper.insert(billInvoice);
1042
+
1043
+        // 返更新ticket
1044
+        tpTicket.setPrice(ticket.getPrice());
1045
+        tpTicket.setBillInvoiceId(billInvoice.getId());
1046
+        tpTicketMapper.updateById(tpTicket);
1047
+        return ResponseBean.success(tpTicket);
1048
+    }
982 1049
 }