| | |
| | | package com.java110.fee.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.po.room.LitigationInfoPo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.mybatis.spring.SqlSessionTemplate; |
| | |
| | | @RequestMapping(value = "/saveLitigationInfo", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveLitigationInfo(@RequestBody JSONObject reqJson) { |
| | | // 必传参数校验 |
| | | Assert.hasKeyAndValue(reqJson, "litigation_date", "请求报文中未包含送诉日期litigation_date"); |
| | | Assert.hasKeyAndValue(reqJson, "arrears_period", "请求报文中未包含欠费区间arrears_period"); |
| | | Assert.hasKeyAndValue(reqJson, "arrears_amount", "请求报文中未包含欠费金额arrears_amount"); |
| | | Assert.hasKeyAndValue(reqJson, "litigationDate", "请求报文中未包含送诉日期litigationDate"); |
| | | Assert.hasKeyAndValue(reqJson, "arrearsPeriod", "请求报文中未包含欠费区间arrearsPeriod"); |
| | | Assert.hasKeyAndValue(reqJson, "arrearsAmount", "请求报文中未包含欠费金额arrearsAmount"); |
| | | Assert.hasKeyAndValue(reqJson, "submitter", "请求报文中未包含送件人员submitter"); |
| | | |
| | | // 转换为POJO |
| | |
| | | // 主键校验 |
| | | Assert.hasKeyAndValue(reqJson, "id", "请求报文中未包含主键ID"); |
| | | // 必传业务参数校验 |
| | | Assert.hasKeyAndValue(reqJson, "litigation_date", "请求报文中未包含送诉日期litigation_date"); |
| | | Assert.hasKeyAndValue(reqJson, "arrears_period", "请求报文中未包含欠费区间arrears_period"); |
| | | Assert.hasKeyAndValue(reqJson, "arrears_amount", "请求报文中未包含欠费金额arrears_amount"); |
| | | Assert.hasKeyAndValue(reqJson, "litigationDate", "请求报文中未包含送诉日期litigationDate"); |
| | | Assert.hasKeyAndValue(reqJson, "arrearsPeriod", "请求报文中未包含欠费区间arrearsPeriod"); |
| | | Assert.hasKeyAndValue(reqJson, "arrearsAmount", "请求报文中未包含欠费金额arrearsAmount"); |
| | | Assert.hasKeyAndValue(reqJson, "submitter", "请求报文中未包含送件人员submitter"); |
| | | |
| | | LitigationInfoPo po = BeanConvertUtil.covertBean(reqJson, LitigationInfoPo.class); |
| | |
| | | /** |
| | | * 分页查询讼诉情况信息列表 |
| | | * |
| | | * @param litigation_date 送诉日期(可选) |
| | | * @param litigationDate 送诉日期(可选) |
| | | * @param submitter 送件人员(可选) |
| | | * @param page 页码(默认1) |
| | | * @param row 每页条数(默认10) |
| | |
| | | */ |
| | | @RequestMapping(value = "/queryLitigationInfo", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryLitigationInfo( |
| | | @RequestParam(value = "litigation_date", required = false) String litigation_date, |
| | | @RequestParam(value = "litigationDate", required = false) String litigationDate, |
| | | @RequestParam(value = "submitter", required = false) String submitter, |
| | | @RequestParam(value = "page", defaultValue = "1") int page, |
| | | @RequestParam(value = "row", defaultValue = "10") int row, |
| | |
| | | |
| | | // 封装查询参数 |
| | | LitigationInfoPo queryPo = new LitigationInfoPo(); |
| | | queryPo.setLitigation_date(litigation_date); |
| | | // queryPo.setLitigationDate(litigationDate); |
| | | queryPo.setSubmitter(submitter); |
| | | queryPo.setPage((page - 1) * row); // 转换为MySQL分页偏移量 |
| | | queryPo.setRow(row); |
| | |
| | | /** |
| | | * 统计讼诉情况信息 |
| | | * |
| | | * @param litigation_date 送诉日期(可选) |
| | | * @param litigationDate 送诉日期(可选) |
| | | * @param submitter 送件人员(可选) |
| | | * @param startCreateTime 开始创建时间(可选,格式:yyyy-MM-dd HH:mm:ss) |
| | | * @param endCreateTime 结束创建时间(可选) |
| | |
| | | */ |
| | | @RequestMapping(value = "/queryLitigationInfoStatistics", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryLitigationInfoStatistics( |
| | | @RequestParam(value = "litigation_date", required = false) String litigation_date, |
| | | @RequestParam(value = "litigationDate", required = false) String litigationDate, |
| | | @RequestParam(value = "submitter", required = false) String submitter, |
| | | @RequestParam(value = "startCreateTime", required = false) String startCreateTime, |
| | | @RequestParam(value = "endCreateTime", required = false) String endCreateTime) { |
| | | |
| | | LitigationInfoPo queryPo = new LitigationInfoPo(); |
| | | queryPo.setLitigation_date(litigation_date); |
| | | queryPo.setSubmitter(submitter); |
| | | queryPo.setStartCreateTime(startCreateTime); |
| | | queryPo.setEndCreateTime(endCreateTime); |
| | | |
| | | // 统计查询 |
| | | Map<String, Object> statistics = sqlSessionTemplate.selectOne( |
| | |
| | | resJson.put("data", statistics); |
| | | |
| | | return ResponseEntity.ok(resJson.toJSONString()); |
| | | } |
| | | |
| | | /** |
| | | * 配套POJO类(内部类形式,也可抽离为独立类) |
| | | */ |
| | | public static class LitigationInfoPo { |
| | | private Integer id; |
| | | private String litigation_date; |
| | | private String arrears_period; |
| | | private Double arrears_amount; |
| | | private Double late_fee; |
| | | private Double acceptance_fee; |
| | | private Double other_fee; |
| | | private Double total_amount; // 数据库自动计算,无需手动赋值 |
| | | private String submitter; |
| | | private String create_time; |
| | | private String update_time; |
| | | // 分页参数 |
| | | private int page; |
| | | private int row; |
| | | // 统计时间范围参数 |
| | | private String startCreateTime; |
| | | private String endCreateTime; |
| | | |
| | | // Getter & Setter |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLitigation_date() { |
| | | return litigation_date; |
| | | } |
| | | |
| | | public void setLitigation_date(String litigation_date) { |
| | | this.litigation_date = litigation_date; |
| | | } |
| | | |
| | | public String getArrears_period() { |
| | | return arrears_period; |
| | | } |
| | | |
| | | public void setArrears_period(String arrears_period) { |
| | | this.arrears_period = arrears_period; |
| | | } |
| | | |
| | | public Double getArrears_amount() { |
| | | return arrears_amount; |
| | | } |
| | | |
| | | public void setArrears_amount(Double arrears_amount) { |
| | | this.arrears_amount = arrears_amount; |
| | | } |
| | | |
| | | public Double getLate_fee() { |
| | | return late_fee; |
| | | } |
| | | |
| | | public void setLate_fee(Double late_fee) { |
| | | this.late_fee = late_fee; |
| | | } |
| | | |
| | | public Double getAcceptance_fee() { |
| | | return acceptance_fee; |
| | | } |
| | | |
| | | public void setAcceptance_fee(Double acceptance_fee) { |
| | | this.acceptance_fee = acceptance_fee; |
| | | } |
| | | |
| | | public Double getOther_fee() { |
| | | return other_fee; |
| | | } |
| | | |
| | | public void setOther_fee(Double other_fee) { |
| | | this.other_fee = other_fee; |
| | | } |
| | | |
| | | public Double getTotal_amount() { |
| | | return total_amount; |
| | | } |
| | | |
| | | public void setTotal_amount(Double total_amount) { |
| | | this.total_amount = total_amount; |
| | | } |
| | | |
| | | public String getSubmitter() { |
| | | return submitter; |
| | | } |
| | | |
| | | public void setSubmitter(String submitter) { |
| | | this.submitter = submitter; |
| | | } |
| | | |
| | | public String getCreate_time() { |
| | | return create_time; |
| | | } |
| | | |
| | | public void setCreate_time(String create_time) { |
| | | this.create_time = create_time; |
| | | } |
| | | |
| | | public String getUpdate_time() { |
| | | return update_time; |
| | | } |
| | | |
| | | public void setUpdate_time(String update_time) { |
| | | this.update_time = update_time; |
| | | } |
| | | |
| | | public int getPage() { |
| | | return page; |
| | | } |
| | | |
| | | public void setPage(int page) { |
| | | this.page = page; |
| | | } |
| | | |
| | | public int getRow() { |
| | | return row; |
| | | } |
| | | |
| | | public void setRow(int row) { |
| | | this.row = row; |
| | | } |
| | | |
| | | public String getStartCreateTime() { |
| | | return startCreateTime; |
| | | } |
| | | |
| | | public void setStartCreateTime(String startCreateTime) { |
| | | this.startCreateTime = startCreateTime; |
| | | } |
| | | |
| | | public String getEndCreateTime() { |
| | | return endCreateTime; |
| | | } |
| | | |
| | | public void setEndCreateTime(String endCreateTime) { |
| | | this.endCreateTime = endCreateTime; |
| | | } |
| | | } |
| | | } |