| @@ -5,7 +5,6 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.service.WxBillAllService; | import com.iformall.service.WxBillAllService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -17,10 +16,9 @@ import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.ModelAttribute; | import org.springframework.web.bind.annotation.ModelAttribute; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Date; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -96,11 +94,6 @@ public class WxBillAllController extends BaseController { | |||||
| if(StringUtils.isNotBlank(wxBillAll.getEndtime())){ | if(StringUtils.isNotBlank(wxBillAll.getEndtime())){ | ||||
| wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59"); | wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59"); | ||||
| } | } | ||||
| if(StringUtils.isBlank(wxBillAll.getEndtime()) && StringUtils.isBlank(wxBillAll.getStarttime())){ | |||||
| SimpleDateFormat sb = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| wxBillAll.setStarttime(sb.format(DateUtils.getFirstDayForCurrMonth(new Date()))); | |||||
| wxBillAll.setEndtime(sb.format(new Date())+" 23:59:59"); | |||||
| } | |||||
| wxBillAll.setTenantId(getTenantId()); | wxBillAll.setTenantId(getTenantId()); | ||||
| Map<String, Object> result = wxBillAllService.getOweBillAsPage(wxBillAll, pageNum, pageSize); | Map<String, Object> result = wxBillAllService.getOweBillAsPage(wxBillAll, pageNum, pageSize); | ||||
| return new ResultData(result); | return new ResultData(result); | ||||
| @@ -119,11 +112,6 @@ public class WxBillAllController extends BaseController { | |||||
| if(StringUtils.isNotBlank(wxBillAll.getEndtime())){ | if(StringUtils.isNotBlank(wxBillAll.getEndtime())){ | ||||
| wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59"); | wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59"); | ||||
| } | } | ||||
| if(StringUtils.isBlank(wxBillAll.getEndtime()) && StringUtils.isBlank(wxBillAll.getStarttime())){ | |||||
| SimpleDateFormat sb = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| wxBillAll.setStarttime(sb.format(DateUtils.getFirstDayForCurrMonth(new Date()))); | |||||
| wxBillAll.setEndtime(sb.format(new Date())+" 23:59:59"); | |||||
| } | |||||
| wxBillAll.setTenantId(getTenantId()); | wxBillAll.setTenantId(getTenantId()); | ||||
| wxBillAllService.exportOweMerchant(wxBillAll, request, response); | wxBillAllService.exportOweMerchant(wxBillAll, request, response); | ||||
| } | } | ||||
| @@ -140,11 +128,6 @@ public class WxBillAllController extends BaseController { | |||||
| if(StringUtils.isNotBlank(wxBillAll.getEndtime())){ | if(StringUtils.isNotBlank(wxBillAll.getEndtime())){ | ||||
| wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59"); | wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59"); | ||||
| } | } | ||||
| if(StringUtils.isBlank(wxBillAll.getEndtime()) && StringUtils.isBlank(wxBillAll.getStarttime())){ | |||||
| SimpleDateFormat sb = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| wxBillAll.setStarttime(sb.format(DateUtils.getFirstDayForCurrMonth(new Date()))); | |||||
| wxBillAll.setEndtime(sb.format(new Date())+" 23:59:59"); | |||||
| } | |||||
| wxBillAll.setTenantId(getTenantId()); | wxBillAll.setTenantId(getTenantId()); | ||||
| wxBillAllService.exportWaitMerchant(wxBillAll, request, response); | wxBillAllService.exportWaitMerchant(wxBillAll, request, response); | ||||
| } | } | ||||
| @@ -161,11 +144,6 @@ public class WxBillAllController extends BaseController { | |||||
| if (StringUtils.isNotBlank(wxBillAll.getEndtime())) { | if (StringUtils.isNotBlank(wxBillAll.getEndtime())) { | ||||
| wxBillAll.setEndtime(wxBillAll.getEndtime() + " 23:59:59"); | wxBillAll.setEndtime(wxBillAll.getEndtime() + " 23:59:59"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(wxBillAll.getEndtime()) && StringUtils.isBlank(wxBillAll.getStarttime())) { | |||||
| SimpleDateFormat sb = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| wxBillAll.setStarttime(sb.format(DateUtils.getFirstDayForCurrMonth(new Date()))); | |||||
| wxBillAll.setEndtime(sb.format(new Date()) + " 23:59:59"); | |||||
| } | |||||
| wxBillAll.setTenantId(getTenantId()); | wxBillAll.setTenantId(getTenantId()); | ||||
| wxBillAllService.exportOweBill(wxBillAll, request, response); | wxBillAllService.exportOweBill(wxBillAll, request, response); | ||||
| } | } | ||||
| @@ -620,30 +620,38 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); | String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); | ||||
| result.put("number", number); | result.put("number", number); | ||||
| //数据 | //数据 | ||||
| if (wxBillAll.getStatus() == null) { | |||||
| List<Integer> statusList = new ArrayList<>(); | |||||
| statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); | |||||
| statusList.add(EnumBillRentStatus.NOT_EXPIRED.getCode()); | |||||
| wxBillAll.setStatusList(statusList); | |||||
| } | |||||
| Integer filterHasPay = wxBillAll.getFilterHasPay(); | |||||
| List<WxBillAllVo> list = wxBillAllMapper.list(wxBillAll); | List<WxBillAllVo> list = wxBillAllMapper.list(wxBillAll); | ||||
| if (!list.isEmpty()) { | if (!list.isEmpty()) { | ||||
| //租金总额 | //租金总额 | ||||
| Long rentSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())).collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| Long rentSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //物业总额 | //物业总额 | ||||
| Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())).collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //押金总额 | //押金总额 | ||||
| Long depositSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | Long depositSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | ||||
| b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | ||||
| .collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| .collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //水费 | //水费 | ||||
| Long waterSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())).collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| Long waterSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //电费 | //电费 | ||||
| Long powerSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())).collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| Long powerSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //空调费 | //空调费 | ||||
| Long airConditioningSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())).collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| Long airConditioningSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //其他费用 | //其他费用 | ||||
| Long otherSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())).collect(Collectors.summingLong(b -> b.getOwe())); | |||||
| Long otherSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); | |||||
| //押金明细 | //押金明细 | ||||
| StringBuffer depositDetail = new StringBuffer(); | StringBuffer depositDetail = new StringBuffer(); | ||||
| list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | ||||
| b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | ||||
| .forEach(b -> { | .forEach(b -> { | ||||
| BigDecimal owe = new BigDecimal(b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||||
| BigDecimal owe = new BigDecimal(filterHasPay != null ? b.getOwe() : b.getReceivePay()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||||
| depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | ||||
| }); | }); | ||||
| @@ -651,7 +659,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| StringBuffer otherDetail = new StringBuffer(); | StringBuffer otherDetail = new StringBuffer(); | ||||
| list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | ||||
| .forEach(b -> { | .forEach(b -> { | ||||
| BigDecimal owe = new BigDecimal(b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||||
| BigDecimal owe = new BigDecimal(filterHasPay != null ? b.getOwe() : b.getReceivePay()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||||
| otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | ||||
| }); | }); | ||||
| //总计 | //总计 | ||||