| @@ -377,8 +377,8 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| * @param sales | * @param sales | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| @GetMapping("revenuePropertyContract") | |||||
| public ResultData revenuePropertyContract(@ModelAttribute WxRentContractRevenueSales sales) { | |||||
| @GetMapping("revenueUpFeesBills") | |||||
| public ResultData revenueUpFeesBills(@ModelAttribute WxRentContractRevenueSales sales) { | |||||
| sales.updateTenantInfo(getTenantInfo()); | sales.updateTenantInfo(getTenantInfo()); | ||||
| WxRentContractAgileUnDeposit udq = new WxRentContractAgileUnDeposit(); | WxRentContractAgileUnDeposit udq = new WxRentContractAgileUnDeposit(); | ||||
| udq.updateTenantInfo(sales); | udq.updateTenantInfo(sales); | ||||
| @@ -423,13 +423,13 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| return new ResultData(wxRentContractService.setRevenueSales(this.getUser(),rentContract,wxRentContract.getSalesMoney(),wxRentContract.getSalesStartTime(),wxRentContract.getSalesEndTime())); | return new ResultData(wxRentContractService.setRevenueSales(this.getUser(),rentContract,wxRentContract.getSalesMoney(),wxRentContract.getSalesStartTime(),wxRentContract.getSalesEndTime())); | ||||
| } | } | ||||
| // //查询合同年限 | |||||
| // @GetMapping("getContractYears") | |||||
| // public ResultData getContractYears(@ModelAttribute WxRentContract wxRentContract) { | |||||
| // if (null == wxRentContract) wxRentContract = new WxRentContract(); | |||||
| // WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | |||||
| // return new ResultData(wxRentContractService.getRentContractYears(rentContract)); | |||||
| // } | |||||
| //查询合同年限 | |||||
| @GetMapping("getContractYears") | |||||
| public ResultData getContractYears(@ModelAttribute WxRentContract wxRentContract) { | |||||
| if (null == wxRentContract) wxRentContract = new WxRentContract(); | |||||
| WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | |||||
| return new ResultData(wxAgileContractService.getRentContractYears(rentContract)); | |||||
| } | |||||
| //查询合同年限已输入销售额情况 | //查询合同年限已输入销售额情况 | ||||
| @PostMapping("getContractYearsSales") | @PostMapping("getContractYearsSales") | ||||
| @@ -10,7 +10,9 @@ import com.iformall.domain.po.WxRentContractAgileRenevue; | |||||
| import com.iformall.domain.po.WxRentContractAgileRenevueFees; | import com.iformall.domain.po.WxRentContractAgileRenevueFees; | ||||
| import com.iformall.domain.po.WxRentContractAgileRenevueItem; | import com.iformall.domain.po.WxRentContractAgileRenevueItem; | ||||
| import com.iformall.domain.po.WxRentContractAgileUnDeposit; | import com.iformall.domain.po.WxRentContractAgileUnDeposit; | ||||
| import com.iformall.domain.po.WxRentContractRevenueSales; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxRentContractYearsVo; | |||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -71,4 +73,6 @@ public interface WxAgileContractService { | |||||
| void renewalAgile(WxRentContract wxRentContract,MallUserInfo user); | void renewalAgile(WxRentContract wxRentContract,MallUserInfo user); | ||||
| void transfer(WxRentContract wxRentContract,MallUserInfo user); | void transfer(WxRentContract wxRentContract,MallUserInfo user); | ||||
| List<WxRentContractYearsVo> getRentContractYears(WxRentContract rentContract); | |||||
| } | } | ||||
| @@ -109,6 +109,4 @@ public interface WxRentContractService { | |||||
| List<WxRentContractRevenueJump> findJumpList(WxRentContractRevenueJump jump); | List<WxRentContractRevenueJump> findJumpList(WxRentContractRevenueJump jump); | ||||
| BigDecimal calcuteContractUsedShopArea(WxRentContract wxRentContract,Long shopId); | |||||
| } | } | ||||
| @@ -27,6 +27,7 @@ import com.iformall.domain.po.WxShop; | |||||
| import com.iformall.domain.po.WxShopUsers; | import com.iformall.domain.po.WxShopUsers; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.BillTimeVo; | import com.iformall.domain.vo.BillTimeVo; | ||||
| import com.iformall.domain.vo.WxRentContractYearsVo; | |||||
| import com.iformall.enums.EnumBillExtraCreateFrom; | import com.iformall.enums.EnumBillExtraCreateFrom; | ||||
| import com.iformall.enums.EnumContractCustomersStatus; | import com.iformall.enums.EnumContractCustomersStatus; | ||||
| import com.iformall.enums.EnumFeesShopTimeType; | import com.iformall.enums.EnumFeesShopTimeType; | ||||
| @@ -79,6 +80,7 @@ import org.springframework.transaction.annotation.Propagation; | |||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Calendar; | import java.util.Calendar; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -1168,5 +1170,82 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { | |||||
| wxAllBillMapper.transferCusName(bill); | wxAllBillMapper.transferCusName(bill); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxRentContractYearsVo> getRentContractYears(WxRentContract rentContract) { | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| int [] diffs = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); | |||||
| int months = diffs[0]; | |||||
| int days = diffs[1]; | |||||
| int ext = months % 12; | |||||
| int years = months/12; | |||||
| if (ext > 0 ) { | |||||
| years = years + 1; | |||||
| }else { | |||||
| if (days > 0 ) { | |||||
| years = years + 1; | |||||
| } | |||||
| } | |||||
| //如果有撤铺日 | |||||
| Date endcontract = rentContract.getEndContractTime(); | |||||
| if (null != endcontract) { | |||||
| endcontract = DateUtils.getDayEnd(endcontract); | |||||
| } | |||||
| List<Date> yearList = this.getYearList(years, 12, rentContract.getRentalStartDate(),endcontract); | |||||
| List<WxRentContractYearsVo> retList = new ArrayList<WxRentContractYearsVo>(); | |||||
| if (null != yearList && yearList.size() > 0) { | |||||
| if (yearList.size() == 1) { | |||||
| WxRentContractYearsVo vo = new WxRentContractYearsVo(); | |||||
| vo.setStart(yearList.get(0)); | |||||
| vo.setEnd(rentContract.getRentalEndDate()); | |||||
| vo.setRemark("第1年度"); | |||||
| vo.setYearIndex(1); | |||||
| retList.add(vo); | |||||
| }else { | |||||
| Date begin = null; | |||||
| for (int i = 0 ; i < yearList.size()-1 ; i ++) { | |||||
| int yearindex = i+1; | |||||
| begin = yearList.get(i); | |||||
| Date end = yearList.get(i+1); | |||||
| Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); | |||||
| WxRentContractYearsVo vo = new WxRentContractYearsVo(); | |||||
| vo.setStart(begin); | |||||
| vo.setEnd(realEnd); | |||||
| vo.setRemark("第"+yearindex+"年度"); | |||||
| vo.setYearIndex(yearindex); | |||||
| retList.add(vo); | |||||
| begin = end; | |||||
| } | |||||
| WxRentContractYearsVo vo = new WxRentContractYearsVo(); | |||||
| vo.setStart(yearList.get(yearList.size()-1)); | |||||
| vo.setEnd(rentContract.getRentalEndDate()); | |||||
| vo.setRemark("第"+yearList.size()+"年度"); | |||||
| vo.setYearIndex(yearList.size()); | |||||
| retList.add(vo); | |||||
| } | |||||
| } | |||||
| if (retList.size() > 0 ) { | |||||
| return retList; | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private List<Date> getYearList(int years,int month,Date rentalStartDate,Date endContractTime ) { | |||||
| List<Date> yearList = new ArrayList<Date>(); | |||||
| for (int i = 0; i < years; i++) { | |||||
| Calendar instance = Calendar.getInstance(); | |||||
| instance.setTime(rentalStartDate); | |||||
| instance.set(Calendar.MILLISECOND, 0); | |||||
| instance.add(Calendar.MONTH, month * i); | |||||
| Date startDate = instance.getTime(); | |||||
| if (null != endContractTime && endContractTime.before(startDate)) { | |||||
| yearList.add(endContractTime); | |||||
| break; | |||||
| }else { | |||||
| yearList.add(startDate); | |||||
| } | |||||
| } | |||||
| return yearList; | |||||
| } | |||||
| } | } | ||||
| @@ -1011,27 +1011,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| }else { | }else { | ||||
| sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",扣点规则计算金额:"+needpay+"."); | sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",扣点规则计算金额:"+needpay+"."); | ||||
| } | } | ||||
| //如果是取高的,则取高计算 | |||||
| if (rentcontract.getType().intValue() == EnumAgileContractType.RENEVUE_UP.getCode().intValue()) { | |||||
| //查询所有参与取高的款项的账单 | |||||
| WxRentContractAgileUnDeposit udq = new WxRentContractAgileUnDeposit(); | |||||
| udq.updateTenantInfo(rentcontract); | |||||
| udq.setRentContractId(rentcontract.getId()); | |||||
| udq.setJoinRenevueUp(EnumYesOrNo.YES.getCode()); | |||||
| List<Long> udlist = wxAgileContractService.findUnDepositFeesIdList(udq); | |||||
| if (null != udlist && udlist.size() > 0 ){ | |||||
| WxAllBill udbill = new WxAllBill(); | |||||
| udbill.updateTenantInfo(rentcontract); | |||||
| udbill.setRentContractId(rentcontract.getId()); | |||||
| udbill.setEnergyFeesIds(udlist); | |||||
| BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill); | |||||
| if (null != uneedPay && uneedPay.compareTo(new BigDecimal(0)) > 0 ){ | |||||
| sb.append("参与取高款项计算金额:"+uneedPay.toPlainString()); | |||||
| if (uneedPay.compareTo(new BigDecimal(needpay)) > 0 ) { | |||||
| needpay = uneedPay.toPlainString(); | |||||
| } | |||||
| } | |||||
| BigDecimal uneedPay = getJoinRenevueUpFeesReceivePayTotal(rentcontract,startime,endtime,true); | |||||
| if (null != uneedPay && uneedPay.compareTo(new BigDecimal(0)) > 0 ){ | |||||
| sb.append("参与取高款项计算金额:"+uneedPay.toPlainString()); | |||||
| if (uneedPay.compareTo(new BigDecimal(needpay)) > 0 ) { | |||||
| needpay = uneedPay.toPlainString(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1043,6 +1027,35 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| private BigDecimal getJoinRenevueUpFeesReceivePayTotal(WxRentContract rentcontract,Date begin,Date end,boolean isEqualTime) { | |||||
| //如果是取高的,则取高计算 | |||||
| if (rentcontract.getType().intValue() == EnumAgileContractType.RENEVUE_UP.getCode().intValue()) { | |||||
| //查询所有参与取高的款项的账单 | |||||
| WxRentContractAgileUnDeposit udq = new WxRentContractAgileUnDeposit(); | |||||
| udq.updateTenantInfo(rentcontract); | |||||
| udq.setRentContractId(rentcontract.getId()); | |||||
| udq.setJoinRenevueUp(EnumYesOrNo.YES.getCode()); | |||||
| List<Long> udlist = wxAgileContractService.findUnDepositFeesIdList(udq); | |||||
| if (null != udlist && udlist.size() > 0 ){ | |||||
| WxAllBill udbill = new WxAllBill(); | |||||
| udbill.updateTenantInfo(rentcontract); | |||||
| udbill.setRentContractId(rentcontract.getId()); | |||||
| udbill.setIsPreview(EnumYesOrNo.NO.getCode()); | |||||
| udbill.setEnergyFeesIds(udlist); | |||||
| if (isEqualTime) { | |||||
| udbill.setStarttimeEqual(begin); | |||||
| udbill.setEndtimeEqual(end); | |||||
| }else { | |||||
| udbill.setStarttime(rentcontract.getYearsBegin()); | |||||
| udbill.setEndtime(rentcontract.getYearsEnd()); | |||||
| }; | |||||
| BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill); | |||||
| return uneedPay; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private void addRevenueSales(WxRentContract rentcontract,Date starttime,Date endtime,String needpay,String sales,BigDecimal saleDecimalValid) { | private void addRevenueSales(WxRentContract rentcontract,Date starttime,Date endtime,String needpay,String sales,BigDecimal saleDecimalValid) { | ||||
| WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); | WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); | ||||
| rs.updateTenantInfo(rentcontract); | rs.updateTenantInfo(rentcontract); | ||||
| @@ -1242,27 +1255,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| BigDecimal receivepay = new BigDecimal(0); | |||||
| //查询合同租金所有应收的账单 | |||||
| //查询所有租金+营业管理费+商业管理费账单的信息,因为设置销售额会自动的创建或者更新对应的账单 | |||||
| WxAllBill rentBillq = new WxAllBill(); | |||||
| rentBillq.updateTenantInfo(rentcontract); | |||||
| rentBillq.setRentContractId(rentcontract.getId()); | |||||
| List<Long> feesIdList = new ArrayList<Long>(); | |||||
| //feesIdList.add(EnumBillAllType.RENT.getEnergyFeesId()); | |||||
| //feesIdList.add(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId()); | |||||
| //feesIdList.add(EnumBillAllType.RENT_OPERATION_MANAGE.getEnergyFeesId()); | |||||
| rentBillq.setEnergyFeesIds(feesIdList); | |||||
| rentBillq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||||
| rentBillq.setStarttime(rentcontract.getYearsBegin()); | |||||
| rentBillq.setEndtime(rentcontract.getYearsEnd()); | |||||
| WxBillSum rentBillSum = wxAllBillMapper.getBillMonthSum(rentBillq); | |||||
| if (null != rentBillSum) { | |||||
| receivepay = receivepay.add(rentBillSum.getNeedPayNumber()); | |||||
| //查询所有参与取高的账单金额 | |||||
| BigDecimal receivepay = getJoinRenevueUpFeesReceivePayTotal(rentcontract,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),false); | |||||
| if (null == receivepay ){ | |||||
| receivepay = new BigDecimal(0); | |||||
| } | } | ||||
| //查询对应的物业账单,包括录入销售额自动生成的 | |||||
| WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo(); | WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo(); | ||||
| vo.setTotalSales(sum.toPlainString()); | vo.setTotalSales(sum.toPlainString()); | ||||
| vo.setTotalRevenue(jumpRevenuePay.toPlainString()); | vo.setTotalRevenue(jumpRevenuePay.toPlainString()); | ||||
| @@ -1277,32 +1275,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) { | private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) { | ||||
| // //计算每一年的基数 | |||||
| // List<String[]> priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); | |||||
| // String[] rentPriceArrs = priceArrs.get(0); | |||||
| // //String[] revenuePriceArrs = priceArrs.get(1); | |||||
| // //计算商业管理费 | |||||
| // String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract); | |||||
| // //计算运营管理费 | |||||
| // String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract); | |||||
| // | |||||
| // //物业费单价 | |||||
| // String[] propertyContractArrs = null; | |||||
| // List<Date> yearList = this.getYearList(rentPriceArrs.length, 12, rentcontract.getRentalStartDate(),null); | |||||
| // int yearIndex = 0; | |||||
| // for( int i = 0 ; i < yearList.size() ; i ++) { | |||||
| // Date yearEndDate = yearList.get(i); | |||||
| // if (rentcontract.getYearsBegin().before(yearEndDate) || rentcontract.getYearsEnd().equals(yearEndDate)) { | |||||
| // yearIndex = i-1; | |||||
| // break; | |||||
| // } | |||||
| // } | |||||
| // if (yearIndex <= 0 ) { | |||||
| // yearIndex = 0; | |||||
| // } | |||||
| // StringBuffer sb = new StringBuffer(""); | |||||
| // return handleBills(user,sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); | |||||
| return null; | |||||
| StringBuffer sb = new StringBuffer(""); | |||||
| return handleBills(user,sb,rentcontract,owe,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN); | |||||
| } | } | ||||
| @@ -1311,10 +1285,4 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return wxRentContractRevenueJumpMapper.findList(jump); | return wxRentContractRevenueJumpMapper.findList(jump); | ||||
| } | } | ||||
| @Override | |||||
| public BigDecimal calcuteContractUsedShopArea(WxRentContract wxRentContract,Long shopId) { | |||||
| //根据合同区间查询已使用合同的总面积 | |||||
| return null; | |||||
| } | |||||
| } | } | ||||