|
|
|
@@ -3,6 +3,7 @@ package com.iformall.controller.rent; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxBillDaily; |
|
|
|
@@ -14,11 +15,14 @@ import com.iformall.domain.po.WxBillPropertyDeposit; |
|
|
|
import com.iformall.domain.po.WxBillRent; |
|
|
|
import com.iformall.domain.po.WxBillRentManage; |
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
import com.iformall.domain.po.WxShop; |
|
|
|
import com.iformall.domain.po.WxUserDataRule; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.domain.vo.WxBillAll; |
|
|
|
import com.iformall.domain.vo.WxBillExcelTemplate; |
|
|
|
import com.iformall.domain.vo.WxBillSum; |
|
|
|
import com.iformall.domain.vo.WxMerchantBillVo; |
|
|
|
import com.iformall.domain.vo.WxShopVo; |
|
|
|
import com.iformall.service.WxBillAllService; |
|
|
|
import com.iformall.service.WxBillDailyService; |
|
|
|
import com.iformall.service.WxBillDepositService; |
|
|
|
@@ -30,6 +34,8 @@ import com.iformall.service.WxBillRentManageService; |
|
|
|
import com.iformall.service.WxBillRentService; |
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
import com.iformall.service.WxPayAccountBillService; |
|
|
|
import com.iformall.service.WxShopService; |
|
|
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@@ -86,6 +92,9 @@ public class WxBillAllController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WxBillOtherDepositService wxBillOtherDepositService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxShopService wxShopService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); |
|
|
|
@@ -116,78 +125,16 @@ public class WxBillAllController extends BaseController { |
|
|
|
WxMerchant m = merchantPage.getList().get(i); |
|
|
|
vo.setMerchantId(m.getId()); |
|
|
|
vo.setMerchantName(m.getName()); |
|
|
|
vo.setShopNumber(getMerchantShopNumber(m)); |
|
|
|
|
|
|
|
WxBillRent br = new WxBillRent(); |
|
|
|
br.updateTenantInfo(wxMerchant); |
|
|
|
br.setStarttime(starttime); |
|
|
|
br.setEndtime(enttime); |
|
|
|
WxBillSum rentSum = wxBillRentService.getBillMonthSum(br); |
|
|
|
if (null == rentSum) { |
|
|
|
rentSum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillRentManage brm = new WxBillRentManage(); |
|
|
|
brm.updateTenantInfo(wxMerchant); |
|
|
|
brm.setStarttime(starttime); |
|
|
|
brm.setEndtime(enttime); |
|
|
|
WxBillSum rentManageSum = wxBillRentManageService.getBillMonthSum(brm); |
|
|
|
if (null == rentManageSum) { |
|
|
|
rentManageSum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillDeposit bd = new WxBillDeposit(); |
|
|
|
bd.updateTenantInfo(wxMerchant); |
|
|
|
bd.setStarttime(starttime); |
|
|
|
bd.setEndtime(enttime); |
|
|
|
WxBillSum rentDepositSum = wxBillRentDepositService.getBillMonthSum(bd); |
|
|
|
if (null == rentDepositSum) { |
|
|
|
rentDepositSum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillProperty bp = new WxBillProperty(); |
|
|
|
bp.updateTenantInfo(wxMerchant); |
|
|
|
bp.setStarttime(starttime); |
|
|
|
bp.setEndtime(enttime); |
|
|
|
WxBillSum propertySum = wxBillPropertyService.getBillMonthSum(bp); |
|
|
|
if (null == propertySum) { |
|
|
|
propertySum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillPropertyDeposit pd = new WxBillPropertyDeposit(); |
|
|
|
pd.updateTenantInfo(wxMerchant); |
|
|
|
pd.setStarttime(starttime); |
|
|
|
pd.setEndtime(enttime); |
|
|
|
WxBillSum propertyDepositSum = wxBillPropertyDepositService.getBillMonthSum(pd); |
|
|
|
if (null == propertyDepositSum) { |
|
|
|
propertyDepositSum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillDaily bdd = new WxBillDaily(); |
|
|
|
bdd.updateTenantInfo(wxMerchant); |
|
|
|
bdd.setStarttime(starttime); |
|
|
|
bdd.setEndtime(enttime); |
|
|
|
WxBillSum dailySum = wxBillDailyService.getBillMonthSum(bdd); |
|
|
|
if (null == dailySum) { |
|
|
|
dailySum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillOther bo = new WxBillOther(); |
|
|
|
bo.updateTenantInfo(wxMerchant); |
|
|
|
bo.setStarttime(starttime); |
|
|
|
bo.setEndtime(enttime); |
|
|
|
WxBillSum otherSum = wxBillOtherService.getBillMonthSum(bo); |
|
|
|
if (null == otherSum) { |
|
|
|
otherSum = new WxBillSum(); |
|
|
|
} |
|
|
|
|
|
|
|
WxBillOtherDeposit bod = new WxBillOtherDeposit(); |
|
|
|
bod.updateTenantInfo(wxMerchant); |
|
|
|
bod.setStarttime(starttime); |
|
|
|
bod.setEndtime(enttime); |
|
|
|
WxBillSum otherDepositSum = wxBillOtherDepositService.getBillMonthSum(bod); |
|
|
|
if (null == otherDepositSum) { |
|
|
|
otherDepositSum = new WxBillSum(); |
|
|
|
} |
|
|
|
WxBillSum rentSum = getBillRentSum(wxMerchant,starttime, enttime); |
|
|
|
WxBillSum rentManageSum = getBillRentManage(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum rentDepositSum = getBillDeposit(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum propertySum = getBillProperty(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum propertyDepositSum = getBillPropertyDeposit(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum dailySum = getBillDaily(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum otherSum = getBillOther(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum otherDepositSum = getBillOtherDeposit(wxMerchant, starttime, enttime); |
|
|
|
|
|
|
|
vo.setNeedPay(calcuteSum(rentSum.getNeedPay(),rentManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(), |
|
|
|
propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay())); |
|
|
|
@@ -203,6 +150,110 @@ public class WxBillAllController extends BaseController { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillRentSum(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillRent br = new WxBillRent(); |
|
|
|
br.updateTenantInfo(tenantEntity); |
|
|
|
br.setStarttime(starttime); |
|
|
|
br.setEndtime(enttime); |
|
|
|
WxBillSum rentSum = wxBillRentService.getBillMonthSum(br); |
|
|
|
if (null == rentSum) { |
|
|
|
rentSum = new WxBillSum(); |
|
|
|
} |
|
|
|
rentSum.setBillName("租赁费用"); |
|
|
|
return rentSum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillRentManage(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillRentManage brm = new WxBillRentManage(); |
|
|
|
brm.updateTenantInfo(tenantEntity); |
|
|
|
brm.setStarttime(starttime); |
|
|
|
brm.setEndtime(enttime); |
|
|
|
WxBillSum rentManageSum = wxBillRentManageService.getBillMonthSum(brm); |
|
|
|
if (null == rentManageSum) { |
|
|
|
rentManageSum = new WxBillSum(); |
|
|
|
} |
|
|
|
rentManageSum.setBillName("租赁营业&商业管理费费用"); |
|
|
|
return rentManageSum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillDeposit(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillDeposit bd = new WxBillDeposit(); |
|
|
|
bd.updateTenantInfo(tenantEntity); |
|
|
|
bd.setStarttime(starttime); |
|
|
|
bd.setEndtime(enttime); |
|
|
|
WxBillSum rentDepositSum = wxBillRentDepositService.getBillMonthSum(bd); |
|
|
|
if (null == rentDepositSum) { |
|
|
|
rentDepositSum = new WxBillSum(); |
|
|
|
} |
|
|
|
rentDepositSum.setBillName("租赁押金费用"); |
|
|
|
return rentDepositSum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillProperty(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillProperty bp = new WxBillProperty(); |
|
|
|
bp.updateTenantInfo(tenantEntity); |
|
|
|
bp.setStarttime(starttime); |
|
|
|
bp.setEndtime(enttime); |
|
|
|
WxBillSum propertySum = wxBillPropertyService.getBillMonthSum(bp); |
|
|
|
if (null == propertySum) { |
|
|
|
propertySum = new WxBillSum(); |
|
|
|
} |
|
|
|
propertySum.setBillName("物业费用"); |
|
|
|
return propertySum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillPropertyDeposit(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillPropertyDeposit pd = new WxBillPropertyDeposit(); |
|
|
|
pd.updateTenantInfo(tenantEntity); |
|
|
|
pd.setStarttime(starttime); |
|
|
|
pd.setEndtime(enttime); |
|
|
|
WxBillSum propertyDepositSum = wxBillPropertyDepositService.getBillMonthSum(pd); |
|
|
|
if (null == propertyDepositSum) { |
|
|
|
propertyDepositSum = new WxBillSum(); |
|
|
|
} |
|
|
|
propertyDepositSum.setBillName("物业押金费用"); |
|
|
|
return propertyDepositSum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillDaily(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillDaily bdd = new WxBillDaily(); |
|
|
|
bdd.updateTenantInfo(tenantEntity); |
|
|
|
bdd.setStarttime(starttime); |
|
|
|
bdd.setEndtime(enttime); |
|
|
|
WxBillSum dailySum = wxBillDailyService.getBillMonthSum(bdd); |
|
|
|
if (null == dailySum) { |
|
|
|
dailySum = new WxBillSum(); |
|
|
|
} |
|
|
|
dailySum.setBillName("日藏水电空调费用"); |
|
|
|
return dailySum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillOther(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillOther bo = new WxBillOther(); |
|
|
|
bo.updateTenantInfo(tenantEntity); |
|
|
|
bo.setStarttime(starttime); |
|
|
|
bo.setEndtime(enttime); |
|
|
|
WxBillSum otherSum = wxBillOtherService.getBillMonthSum(bo); |
|
|
|
if (null == otherSum) { |
|
|
|
otherSum = new WxBillSum(); |
|
|
|
} |
|
|
|
otherSum.setBillName("其他费用"); |
|
|
|
return otherSum; |
|
|
|
} |
|
|
|
|
|
|
|
private WxBillSum getBillOtherDeposit(TenantEntity tenantEntity,Date starttime, Date enttime) { |
|
|
|
WxBillOtherDeposit bod = new WxBillOtherDeposit(); |
|
|
|
bod.updateTenantInfo(tenantEntity); |
|
|
|
bod.setStarttime(starttime); |
|
|
|
bod.setEndtime(enttime); |
|
|
|
WxBillSum otherDepositSum = wxBillOtherDepositService.getBillMonthSum(bod); |
|
|
|
if (null == otherDepositSum) { |
|
|
|
otherDepositSum = new WxBillSum(); |
|
|
|
} |
|
|
|
otherDepositSum.setBillName("其他押金费用"); |
|
|
|
return otherDepositSum; |
|
|
|
} |
|
|
|
|
|
|
|
private String calcuteSum(String... money) { |
|
|
|
if (null != money) { |
|
|
|
BigDecimal total = new BigDecimal(0); |
|
|
|
@@ -218,6 +269,68 @@ public class WxBillAllController extends BaseController { |
|
|
|
return "0"; |
|
|
|
} |
|
|
|
|
|
|
|
private String getMerchantShopNumber(WxMerchant merchant) { |
|
|
|
List<WxShopVo> shopList = wxShopService.findMerchantShopVoList(merchant, merchant.getId()); |
|
|
|
if (null != shopList && shopList.size() > 0 ) { |
|
|
|
StringBuffer sb = new StringBuffer(""); |
|
|
|
for (int i = 0 ; i < shopList.size() ; i ++) { |
|
|
|
WxShopVo v = shopList.get(i); |
|
|
|
sb.append(v.getShopNumber()).append(","); |
|
|
|
} |
|
|
|
return sb.toString(); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("oneMerchantBillList") |
|
|
|
public ResultData oneMerchantBillList(@ModelAttribute WxMerchant wxMerchant) { |
|
|
|
if (null == wxMerchant.getId()) { |
|
|
|
return new ResultData(Result.ERROR,"请选择商户"); |
|
|
|
} |
|
|
|
wxMerchant.updateTenantInfo(getTenantInfo()); |
|
|
|
Date starttime = wxMerchant.getStarttime(); |
|
|
|
Date enttime = wxMerchant.getEndtime(); |
|
|
|
wxMerchant.setStarttime(null); |
|
|
|
wxMerchant.setEndtime(null); |
|
|
|
WxMerchant m = wxMerchantService.selectById(wxMerchant.getId()); |
|
|
|
if (null == m) { |
|
|
|
return new ResultData(Result.ERROR,"商户未查询到"); |
|
|
|
} |
|
|
|
WxMerchantBillVo vo = new WxMerchantBillVo(); |
|
|
|
vo.setMerchantId(m.getId()); |
|
|
|
vo.setMerchantName(m.getName()); |
|
|
|
vo.setShopNumber(getMerchantShopNumber(m)); |
|
|
|
|
|
|
|
WxBillSum rentSum = getBillRentSum(wxMerchant,starttime, enttime); |
|
|
|
WxBillSum rentManageSum = getBillRentManage(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum rentDepositSum = getBillDeposit(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum propertySum = getBillProperty(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum propertyDepositSum = getBillPropertyDeposit(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum dailySum = getBillDaily(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum otherSum = getBillOther(wxMerchant, starttime, enttime); |
|
|
|
WxBillSum otherDepositSum = getBillOtherDeposit(wxMerchant, starttime, enttime); |
|
|
|
|
|
|
|
vo.setNeedPay(calcuteSum(rentSum.getNeedPay(),rentManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(), |
|
|
|
propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay())); |
|
|
|
vo.setPaid(calcuteSum(rentSum.getPaid(),rentManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(), |
|
|
|
propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid())); |
|
|
|
vo.setOwe(calcuteSum(rentSum.getOwe(),rentManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(), |
|
|
|
propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe())); |
|
|
|
|
|
|
|
List<WxBillSum> sumlist = new ArrayList<>(); |
|
|
|
sumlist.add(rentSum); |
|
|
|
sumlist.add(rentManageSum); |
|
|
|
sumlist.add(rentDepositSum); |
|
|
|
sumlist.add(propertySum); |
|
|
|
sumlist.add(propertyDepositSum); |
|
|
|
sumlist.add(dailySum); |
|
|
|
sumlist.add(otherSum); |
|
|
|
sumlist.add(otherDepositSum); |
|
|
|
vo.setBillSumList(sumlist); |
|
|
|
|
|
|
|
return new ResultData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("oweBillCount") |
|
|
|
|