jialh
1 天以前 dd6687b118561100e1677e88a9c2f5842a54c531
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
package com.java110.fee.api;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.fee.bmo.importFeeDetail.IDeleteImportFeeDetailBMO;
import com.java110.fee.bmo.importFeeDetail.IGetImportFeeDetailBMO;
import com.java110.fee.bmo.importFeeDetail.ISaveImportFeeDetailBMO;
import com.java110.fee.bmo.importFeeDetail.IUpdateImportFeeDetailBMO;
import com.java110.po.importFee.MpFifthPaymentRecord;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.vo.ResultVo;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 第五次拟付实付记录接口
 * 匹配原有 ImportFeeApi 代码风格
 */
@RestController
@RequestMapping(value = "/mpFifthPaymentRecord")
public class MpFifthPaymentRecordApi {
 
    @Autowired
    private ISaveImportFeeDetailBMO saveImportFeeDetailBMOImpl;
    @Autowired
    private IUpdateImportFeeDetailBMO updateImportFeeDetailBMOImpl;
    @Autowired
    private IDeleteImportFeeDetailBMO deleteImportFeeDetailBMOImpl;
    @Autowired
    private IGetImportFeeDetailBMO getImportFeeDetailBMOImpl;
 
    /**
     * 保存第五次拟付实付记录
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/saveMpFifthPaymentRecord
     * @path /app/mpFifthPaymentRecord/saveMpFifthPaymentRecord
     */
    @RequestMapping(value = "/saveMpFifthPaymentRecord", method = RequestMethod.POST)
    public ResponseEntity<String> saveMpFifthPaymentRecord(@RequestBody JSONObject reqJson) {
        // 核心参数校验
        Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
        Assert.hasKeyAndValue(reqJson, "fifthPlannedPaymentAmount", "请求报文中未包含第五次拟付金额");
        Assert.hasKeyAndValue(reqJson, "plannedPaymentDate", "请求报文中未包含拟付日期");
 
        // 将JSON参数转换为MpFifthPaymentRecord实体类
        MpFifthPaymentRecord mpFifthPaymentRecord = BeanConvertUtil.covertBean(reqJson, MpFifthPaymentRecord.class);
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return saveImportFeeDetailBMOImpl.save(mpFifthPaymentRecord);
    }
 
 
    public ResponseEntity<String> saveMpFifthPaymentRecord(MpFifthPaymentRecord mpFifthPaymentRecord) {
        return saveImportFeeDetailBMOImpl.save(mpFifthPaymentRecord);
    }
 
 
    /**
     * 修改第五次拟付实付记录
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/updateMpFifthPaymentRecord
     * @path /app/mpFifthPaymentRecord/updateMpFifthPaymentRecord
     */
    @RequestMapping(value = "/updateMpFifthPaymentRecord", method = RequestMethod.POST)
    public ResponseEntity<String> updateMpFifthPaymentRecord(@RequestBody JSONObject reqJson) {
        // 主键校验(修改必须传id)
        Assert.hasKeyAndValue(reqJson, "id", "请求报文中未包含主键ID");
        Assert.hasKeyAndValue(reqJson, "id", "主键ID不能为空");
 
        // 将JSON参数转换为MpFifthPaymentRecord实体类
        MpFifthPaymentRecord mpFifthPaymentRecord = BeanConvertUtil.covertBean(reqJson, MpFifthPaymentRecord.class);
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return updateImportFeeDetailBMOImpl.update(mpFifthPaymentRecord);
    }
 
    /**
     * 删除第五次拟付实付记录
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/deleteMpFifthPaymentRecord
     * @path /app/mpFifthPaymentRecord/deleteMpFifthPaymentRecord
     */
    @RequestMapping(value = "/deleteMpFifthPaymentRecord", method = RequestMethod.POST)
    public ResponseEntity<String> deleteMpFifthPaymentRecord(@RequestBody JSONObject reqJson) {
        // 必要参数校验
        Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
        Assert.hasKeyAndValue(reqJson, "id", "主键ID不能为空");
 
        // 将JSON参数转换为MpFifthPaymentRecord实体类
        MpFifthPaymentRecord mpFifthPaymentRecord = BeanConvertUtil.covertBean(reqJson, MpFifthPaymentRecord.class);
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return deleteImportFeeDetailBMOImpl.delete(mpFifthPaymentRecord);
    }
 
    /**
     * 分页查询第五次拟付实付记录列表
     *
     * @param mpId             打印记录ID(必填)
     * @param page             页码
     * @param row              每页条数
     * @param category         类别(可选)
     * @param reimburser       报销人(可选)
     * @param startDate        开始日期(可选)
     * @param endDate          结束日期(可选)
     * @param id               主键ID(可选)
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/queryMpFifthPaymentRecord
     * @path /app/mpFifthPaymentRecord/queryMpFifthPaymentRecord
     */
    @RequestMapping(value = "/queryMpFifthPaymentRecord", method = RequestMethod.GET)
    public ResponseEntity<String> queryMpFifthPaymentRecord(@RequestParam(value = "mpId") String mpId,
                                                           @RequestParam(value = "page") int page,
                                                           @RequestParam(value = "row") int row,
                                                           @RequestParam(value = "category", required = false) String category,
                                                           @RequestParam(value = "reimburser", required = false) String reimburser,
                                                           @RequestParam(value = "startDate", required = false) String startDate,
                                                           @RequestParam(value = "endDate", required = false) String endDate,
                                                           @RequestParam(value = "id", required = false) String id) {
        // 封装查询DTO
        MpFifthPaymentRecord mpFifthPaymentRecordDto = new MpFifthPaymentRecord();
        mpFifthPaymentRecordDto.setPage(page);
        mpFifthPaymentRecordDto.setRow(row);
        mpFifthPaymentRecordDto.setMpId(mpId);
        mpFifthPaymentRecordDto.setCategory(category);
        mpFifthPaymentRecordDto.setReimburser(reimburser);
        
        // 设置其他查询条件
        if (id != null && !id.isEmpty()) {
            mpFifthPaymentRecordDto.setId(id);
        }
        
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return getImportFeeDetailBMOImpl.get(mpFifthPaymentRecordDto);
    }
 
    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;
    /**
     * 分页查询第五次拟付实付记录列表
     *
     * @param mpId             打印记录ID(必填)
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/queryMpFifthPaymentRecordAll
     * @path /app/mpFifthPaymentRecord/queryMpFifthPaymentRecordAll
     */
    @RequestMapping(value = "/queryMpFifthPaymentRecordAll", method = RequestMethod.GET)
    public ResponseEntity<String> queryMpFifthPaymentRecordAll(@RequestParam(value = "mpId") String mpId) {
        // 封装查询DTO
        MpFifthPaymentRecord mpFifthPaymentRecordDto = new MpFifthPaymentRecord();
        mpFifthPaymentRecordDto.setMpId(mpId);
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        List<Object> objects = sqlSessionTemplate.selectList("mpFifthPaymentRecordServiceDaoImpl.getMpFifthPaymentRecordInfoAll",BeanConvertUtil.beanCovertMap(mpFifthPaymentRecordDto));
        List<Object> objects2 = sqlSessionTemplate.selectList("mpFifthPaymentRecordServiceDaoImpl.getMpFifthPaymentRecordInfoAll2",BeanConvertUtil.beanCovertMap(mpFifthPaymentRecordDto));
        if (objects == null) {
            objects = new ArrayList<>();
        }
        objects.addAll(objects2); // 核心合并操作
        ResultVo resultVo = new ResultVo(objects);
        return new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
    }
 
    /**
     * 根据ID查询单条第五次拟付实付记录
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/getMpFifthPaymentRecordById
     * @path /app/mpFifthPaymentRecord/getMpFifthPaymentRecordById
     */
    @RequestMapping(value = "/getMpFifthPaymentRecordById", method = RequestMethod.POST)
    public ResponseEntity<String> getMpFifthPaymentRecordById(@RequestBody JSONObject reqJson) {
        // 主键校验
        Assert.hasKeyAndValue(reqJson, "id", "请求报文中未包含主键ID");
        Assert.hasKeyAndValue(reqJson, "id", "主键ID不能为空");
 
        // 封装查询DTO
        MpFifthPaymentRecord mpFifthPaymentRecordDto = new MpFifthPaymentRecord();
        mpFifthPaymentRecordDto.setId("id");
        
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return getImportFeeDetailBMOImpl.get(mpFifthPaymentRecordDto);
    }
 
    /**
     * 根据打印记录ID查询记录
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/getMpFifthPaymentRecordByMpId
     * @path /app/mpFifthPaymentRecord/getMpFifthPaymentRecordByMpId
     */
    @RequestMapping(value = "/getMpFifthPaymentRecordByMpId", method = RequestMethod.POST)
    public ResponseEntity<String> getMpFifthPaymentRecordByMpId(@RequestBody JSONObject reqJson) {
        // 参数校验
        Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
 
        // 封装查询DTO
        MpFifthPaymentRecord mpFifthPaymentRecordDto = new MpFifthPaymentRecord();
        mpFifthPaymentRecordDto.setMpId(reqJson.getString("mpId"));
        
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return getImportFeeDetailBMOImpl.get(mpFifthPaymentRecordDto);
    }
 
    /**
     * 查询第五次拟付实付统计信息
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/queryPaymentStatistics
     * @path /app/mpFifthPaymentRecord/queryPaymentStatistics
     */
    @RequestMapping(value = "/queryPaymentStatistics", method = RequestMethod.POST)
    public ResponseEntity<String> queryPaymentStatistics(@RequestBody JSONObject reqJson) {
        // 参数校验
        Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
 
        // 封装查询DTO
        MpFifthPaymentRecord mpFifthPaymentRecordDto = new MpFifthPaymentRecord();
        mpFifthPaymentRecordDto.setMpId(reqJson.getString("mpId"));
        
        // 可选参数:时间范围
        if (reqJson.containsKey("startDate")) {
            try {
                mpFifthPaymentRecordDto.setStartDate(reqJson.getDate("startDate"));
            } catch (Exception e) {
                // 日期格式转换异常处理
                mpFifthPaymentRecordDto.setStartDate(null);
            }
        }
        if (reqJson.containsKey("endDate")) {
            try {
                mpFifthPaymentRecordDto.setEndDate(reqJson.getDate("endDate"));
            } catch (Exception e) {
                // 日期格式转换异常处理
                mpFifthPaymentRecordDto.setEndDate(null);
            }
        }
        
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return getImportFeeDetailBMOImpl.get(mpFifthPaymentRecordDto);
    }
 
    /**
     * 查询实付与拟付对比分析
     *
     * @param reqJson 请求参数
     * @return 响应结果
     * @serviceCode /mpFifthPaymentRecord/queryPaymentComparison
     * @path /app/mpFifthPaymentRecord/queryPaymentComparison
     */
    @RequestMapping(value = "/queryPaymentComparison", method = RequestMethod.POST)
    public ResponseEntity<String> queryPaymentComparison(@RequestBody JSONObject reqJson) {
        // 参数校验
        Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
        Assert.hasKeyAndValue(reqJson, "startDate", "请求报文中未包含开始日期");
        Assert.hasKeyAndValue(reqJson, "endDate", "请求报文中未包含结束日期");
 
        // 封装查询DTO
        MpFifthPaymentRecord mpFifthPaymentRecordDto = new MpFifthPaymentRecord();
        mpFifthPaymentRecordDto.setMpId(reqJson.getString("mpId"));
        
        // 处理日期参数
        try {
            mpFifthPaymentRecordDto.setStartDate(reqJson.getDate("startDate"));
            mpFifthPaymentRecordDto.setEndDate(reqJson.getDate("endDate"));
        } catch (Exception e) {
            // 日期格式转换异常处理
            mpFifthPaymentRecordDto.setStartDate(null);
            mpFifthPaymentRecordDto.setEndDate(null);
        }
        
        // 可选参数:类别筛选
        if (reqJson.containsKey("category")) {
            mpFifthPaymentRecordDto.setCategory(reqJson.getString("category"));
        }
        
        // 由于BMO接口使用MaintenancePayment,这里需要做适配转换
        return getImportFeeDetailBMOImpl.get(mpFifthPaymentRecordDto);
    }
}