| @@ -1,11 +1,13 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.service.WxBillAllService; | import com.iformall.service.WxBillAllService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -32,8 +34,26 @@ public class WxBillController extends BaseController { | |||||
| @ApiOperation("所有欠缴和待缴的数据") | @ApiOperation("所有欠缴和待缴的数据") | ||||
| @PostMapping("listBillOweAndWaitPay") | @PostMapping("listBillOweAndWaitPay") | ||||
| public ResultData listBillOweAndWaitPay(@RequestBody WxBillAll wxBillAll) { | public ResultData listBillOweAndWaitPay(@RequestBody WxBillAll wxBillAll) { | ||||
| if(StringUtils.isEmpty(wxBillAll.getTenantId())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId为空"); | |||||
| } | |||||
| if(wxBillAll.getMerchantId()==null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId为空"); | |||||
| } | |||||
| List<Map<String,Object>> result=wxBillAllService.listBillOweAndWaitPay(wxBillAll); | List<Map<String,Object>> result=wxBillAllService.listBillOweAndWaitPay(wxBillAll); | ||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } | } | ||||
| @ApiOperation("账单") | |||||
| @PostMapping("listBill") | |||||
| public ResultData listBill(@RequestBody WxBillAll wxBillAll) { | |||||
| if(StringUtils.isEmpty(wxBillAll.getTenantId())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId为空"); | |||||
| } | |||||
| if(wxBillAll.getMerchantId()==null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId为空"); | |||||
| } | |||||
| return wxBillAllService.listBill(wxBillAll); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,42 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumBillType { | |||||
| RENT(1,"租金"), | |||||
| DEPOSIT(2,"押金"), | |||||
| PROPERTY(3,"物业"), | |||||
| WATER(4, "水费"), | |||||
| POWER(5, "电费"), | |||||
| ROUTINE(6,"其他") | |||||
| ; | |||||
| public static EnumBillType getEnum(Integer code) { | |||||
| for (EnumBillType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumBillType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,43 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumBillTypeParam { | |||||
| RENT(1,"租金"), | |||||
| RENT_DEPOSIT(2,"租赁押金"), | |||||
| PROPERTY(3,"物业"), | |||||
| PROPERTY_DEPOSIT(4,"物业押金"), | |||||
| WATER(5, "水费"), | |||||
| POWER(6, "电费"), | |||||
| ROUTINE(7,"其他") | |||||
| ; | |||||
| public static EnumBillTypeParam getEnum(Integer code) { | |||||
| for (EnumBillTypeParam value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumBillTypeParam(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -14,4 +15,6 @@ public interface WxBillAllService { | |||||
| List<Map<String,Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | List<Map<String,Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | ||||
| ResultData listBill(WxBillAll wxBillAll); | |||||
| } | } | ||||
| @@ -2,9 +2,13 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.enums.EnumBillRentStatus; | import com.iformall.enums.EnumBillRentStatus; | ||||
| import com.iformall.enums.EnumBillType; | |||||
| import com.iformall.enums.EnumBillTypeParam; | |||||
| import com.iformall.mapper.WxBillAllMapper; | import com.iformall.mapper.WxBillAllMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| @@ -49,9 +53,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| //更新各账单状态 | //更新各账单状态 | ||||
| updateBillStatus(record); | updateBillStatus(record); | ||||
| //得到当前月 | //得到当前月 | ||||
| String month=DateUtils.getSystemTime("yyyy-MM"); | |||||
| String month = DateUtils.getSystemTime("yyyy-MM"); | |||||
| //获取账单信息-欠缴笔数、欠缴金额、结清笔数、结清金额 | //获取账单信息-欠缴笔数、欠缴金额、结清笔数、结清金额 | ||||
| Object billInfo = getBillInfo(record.getTenantId(),month); | |||||
| Object billInfo = getBillInfo(record.getTenantId(), month); | |||||
| //设置查询参数-当前月 | //设置查询参数-当前月 | ||||
| record.setMonth(month); | record.setMonth(month); | ||||
| //分页-页数、条数 | //分页-页数、条数 | ||||
| @@ -77,6 +81,45 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| return wxBillAllMapper.listData(wxBillAll); | return wxBillAllMapper.listData(wxBillAll); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData listBill(WxBillAll wxBillAll) { | |||||
| //更新各账单状态 | |||||
| updateBillStatus(wxBillAll); | |||||
| if(wxBillAll.getStarttime()!=null && wxBillAll.getEndtime()==null){ | |||||
| String month = DateUtils.getSystemTime("yyyy-MM"); | |||||
| wxBillAll.setMonth(month); | |||||
| } | |||||
| //账单类型 | |||||
| if (wxBillAll.getBillTypeValue().equals(EnumBillType.RENT.getCode())) { | |||||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.RENT.getCode()); | |||||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.DEPOSIT.getCode())) { | |||||
| wxBillAll.setBillTypeValue(null); | |||||
| ArrayList typeList = new ArrayList(); | |||||
| typeList.add(EnumBillTypeParam.RENT_DEPOSIT.getCode()); | |||||
| typeList.add(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()); | |||||
| wxBillAll.setTypeList(typeList); | |||||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.PROPERTY.getCode())) { | |||||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.PROPERTY.getCode()); | |||||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.WATER.getCode())) { | |||||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.WATER.getCode()); | |||||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.POWER.getCode())) { | |||||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.POWER.getCode()); | |||||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.ROUTINE.getCode())) { | |||||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.ROUTINE.getCode()); | |||||
| } else { | |||||
| logger.info("账单不存在"); | |||||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||||
| } | |||||
| if(wxBillAll.getPageIndex()!=null && wxBillAll.getPageIndex()!=null){ | |||||
| PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize()); | |||||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(maps); | |||||
| return new ResultData(pageInfo); | |||||
| } | |||||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||||
| return new ResultData(maps); | |||||
| } | |||||
| private void updateBillStatus(WxBillAll record) { | private void updateBillStatus(WxBillAll record) { | ||||
| logger.info("更新各账单状态开始"); | logger.info("更新各账单状态开始"); | ||||
| //更新日常账单状态 | //更新日常账单状态 | ||||
| @@ -102,7 +145,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| logger.info("更新各账单状态结束"); | logger.info("更新各账单状态结束"); | ||||
| } | } | ||||
| private Object getBillInfo(String tenantId,String month) { | |||||
| private Object getBillInfo(String tenantId, String month) { | |||||
| WxBillAll record = new WxBillAll(); | WxBillAll record = new WxBillAll(); | ||||
| record.setTenantId(tenantId); | record.setTenantId(tenantId); | ||||
| record.setMonth(month); | record.setMonth(month); | ||||
| @@ -109,6 +109,12 @@ | |||||
| <if test="null!=starttime and null!=endtime"> | <if test="null!=starttime and null!=endtime"> | ||||
| and bill.receive_date between #{starttime} and #{endtime} | and bill.receive_date between #{starttime} and #{endtime} | ||||
| </if> | </if> | ||||
| <if test=" null != status "> | |||||
| and bill.status=#{status} | |||||
| </if> | |||||
| <if test=" null != billTypeValue "> | |||||
| and bill.bill_type_value=#{billTypeValue} | |||||
| </if> | |||||
| order by bill.id,bill.merchant_id,bill.receive_date | order by bill.id,bill.merchant_id,bill.receive_date | ||||
| </select> | </select> | ||||