| @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | |||||
| /**w | |||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @RestController | @RestController | ||||
| @@ -102,7 +102,7 @@ public class WxMerchantTradeDailyController extends BaseController { | |||||
| if (null == wxMerchantTradeDaily) { | if (null == wxMerchantTradeDaily) { | ||||
| wxMerchantTradeDaily = new WxMerchantTradeDaily(); | wxMerchantTradeDaily = new WxMerchantTradeDaily(); | ||||
| } | } | ||||
| wxMerchantTradeDaily.setTenantId(getTenantId()); | |||||
| wxMerchantTradeDaily.setSortColumns(BaseEntity.SortField.ReportDate_DESC,BaseEntity.SortField.MerchantId_DESC); | wxMerchantTradeDaily.setSortColumns(BaseEntity.SortField.ReportDate_DESC,BaseEntity.SortField.MerchantId_DESC); | ||||
| wxMerchantTradeDailyService.exportData(wxMerchantTradeDaily, request, response); | wxMerchantTradeDailyService.exportData(wxMerchantTradeDaily, request, response); | ||||
| } | } | ||||
| @@ -0,0 +1,2 @@ | |||||
| alter table wx_bill_rent | |||||
| add column `join_rent_price` SMALLINT (1) NULL DEFAULT 0 COMMENT '联营租金'; | |||||
| @@ -0,0 +1,2 @@ | |||||
| alter table wx_bill_rent | |||||
| modify column `join_rent_price` BIGINT(20) NULL DEFAULT NULL COMMENT '联营扣点率'; | |||||
| @@ -106,5 +106,6 @@ public class WxBillDaily extends BaseEntity{ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | ||||
| private Date endtime; | private Date endtime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| } | } | ||||
| @@ -130,5 +130,6 @@ public class WxBillOther extends BaseEntity { | |||||
| @Transient | @Transient | ||||
| private List<Map<String, Object>> shops; | private List<Map<String, Object>> shops; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| } | } | ||||
| @@ -139,5 +139,6 @@ public class WxBillOtherDeposit extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | ||||
| private Date endtime; | private Date endtime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| } | } | ||||
| @@ -184,4 +184,7 @@ public class WxBillProperty extends BaseEntity { | |||||
| private String latePayMoneyBefore; | private String latePayMoneyBefore; | ||||
| @Transient | @Transient | ||||
| private String latePayMoneyUpdate; | private String latePayMoneyUpdate; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| } | } | ||||
| @@ -76,5 +76,7 @@ public class WxBillPropertyDeposit extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "支付方式:见枚举EnumBillPayWay", name = "payWay") | @io.swagger.annotations.ApiModelProperty(value = "支付方式:见枚举EnumBillPayWay", name = "payWay") | ||||
| private Integer payWay; | private Integer payWay; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| } | } | ||||
| @@ -192,6 +192,12 @@ public class WxBillRent extends BaseEntity { | |||||
| private String latePayMoneyBefore; | private String latePayMoneyBefore; | ||||
| @Transient | @Transient | ||||
| private String latePayMoneyUpdate; | private String latePayMoneyUpdate; | ||||
| @Transient | |||||
| private String busDiscountRatio; | private String busDiscountRatio; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice") | |||||
| private Long joinRentPrice; | |||||
| } | } | ||||
| @@ -12,7 +12,6 @@ public enum EnumBillRentStatus { | |||||
| NOT_EXPIRED(4,"未到期"), | NOT_EXPIRED(4,"未到期"), | ||||
| RETURN(5, "已退还"), | RETURN(5, "已退还"), | ||||
| INVALID(6, "失效"), | INVALID(6, "失效"), | ||||
| FREEZE(7, "冻结(结算单审核过程中)"), | |||||
| ; | ; | ||||
| public static EnumBillRentStatus getEnum(Integer code) { | public static EnumBillRentStatus getEnum(Integer code) { | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumFreezeType { | |||||
| DEF(0, "正常"), | |||||
| YES(1, "冻结"), | |||||
| ; | |||||
| public static EnumFreezeType getEnum(Integer code) { | |||||
| for (EnumFreezeType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumFreezeType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -8,7 +8,8 @@ package com.iformall.enums; | |||||
| public enum EnumRentContractAdjustRatioWay { | public enum EnumRentContractAdjustRatioWay { | ||||
| RATIO(1, "按比例"), | RATIO(1, "按比例"), | ||||
| MONEY(2, "按金额"),; | |||||
| MONEY(2, "按金额"), | |||||
| CUSTOM(3, "自定义"),; | |||||
| public static EnumRentContractAdjustRatioWay getEnum(Integer code) { | public static EnumRentContractAdjustRatioWay getEnum(Integer code) { | ||||
| for (EnumRentContractAdjustRatioWay value : values()) { | for (EnumRentContractAdjustRatioWay value : values()) { | ||||
| @@ -4,9 +4,11 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillSettle; | import com.iformall.domain.po.WxBillSettle; | ||||
| import com.iformall.domain.po.WxBillSettleBill; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author luozukai | * @author luozukai | ||||
| @@ -37,4 +39,6 @@ public interface WxBillSettleService { | |||||
| ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo); | ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo); | ||||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle); | void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle); | ||||
| void updateFreeze(List<WxBillSettleBill> billList, int status); | |||||
| } | } | ||||
| @@ -321,7 +321,11 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| long newReceivePay; | long newReceivePay; | ||||
| if(ratioVo != null){ | if(ratioVo != null){ | ||||
| newReceivePay = ratioVo.getPrice(); | newReceivePay = ratioVo.getPrice(); | ||||
| //ratio = ratioVo.getRatio(); | |||||
| //wxBillRent.setPayRatio(ratioVo.getRatio().longValue()); | |||||
| //如果在跳点区间中,修改扣点率 | |||||
| if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ | |||||
| wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio()); | |||||
| } | |||||
| }else{ | }else{ | ||||
| BigDecimal hundred = new BigDecimal(100); | BigDecimal hundred = new BigDecimal(100); | ||||
| BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); | BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); | ||||
| @@ -329,7 +333,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | ||||
| newReceivePay = price.multiply(hundred).longValue(); | newReceivePay = price.multiply(hundred).longValue(); | ||||
| } | } | ||||
| wxBillRent.setJoinRentPrice(newReceivePay); | |||||
| if(newReceivePay > wxBillRent.getReceivePay()){ | if(newReceivePay > wxBillRent.getReceivePay()){ | ||||
| wxBillRent.setReceivePay(newReceivePay); | wxBillRent.setReceivePay(newReceivePay); | ||||
| } | } | ||||
| @@ -338,11 +342,6 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| Long newPrice = newReceivePay; | Long newPrice = newReceivePay; | ||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| //如果在跳点区间中,修改扣点率 | |||||
| if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ | |||||
| wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio()); | |||||
| wxBillRent.setPayRatio(new Long(ratio)); | |||||
| } | |||||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | ||||
| if (!oldPrice.equals(newPrice)) { | if (!oldPrice.equals(newPrice)) { | ||||
| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumBillRentStatus; | import com.iformall.enums.EnumBillRentStatus; | ||||
| import com.iformall.enums.EnumBillType; | import com.iformall.enums.EnumBillType; | ||||
| import com.iformall.enums.EnumFreezeType; | |||||
| import com.iformall.enums.EnumSettleBillType; | import com.iformall.enums.EnumSettleBillType; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxBillSettleService; | import com.iformall.service.WxBillSettleService; | ||||
| @@ -69,6 +70,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| return billSettle; | return billSettle; | ||||
| } | } | ||||
| @Override | |||||
| public void updateFreeze(List<WxBillSettleBill> billList,int status){ | public void updateFreeze(List<WxBillSettleBill> billList,int status){ | ||||
| for (WxBillSettleBill bill:billList) { | for (WxBillSettleBill bill:billList) { | ||||
| if(EnumBillType.RENT.getCode().equals(bill.getBillType())) { | if(EnumBillType.RENT.getCode().equals(bill.getBillType())) { | ||||
| @@ -132,8 +134,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| //改为冻结状态 | //改为冻结状态 | ||||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | ||||
| updateFreeze(record.getReceiveBillIds(),EnumBillRentStatus.FREEZE.getCode()); | |||||
| updateFreeze(record.getPayBillIds(),EnumBillRentStatus.FREEZE.getCode()); | |||||
| updateFreeze(record.getReceiveBillIds(), EnumFreezeType.YES.getCode()); | |||||
| updateFreeze(record.getPayBillIds(),EnumFreezeType.YES.getCode()); | |||||
| } | } | ||||
| //启动审批流 | //启动审批流 | ||||
| @@ -88,6 +88,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| private WxRentContractMapper wxRentContractMapper; | private WxRentContractMapper wxRentContractMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxBillSettleMapper wxBillSettleMapper; | private WxBillSettleMapper wxBillSettleMapper; | ||||
| @Autowired | |||||
| private WxBillSettleService wxBillSettleService; | |||||
| /** | /** | ||||
| * 获取流程key | * 获取流程key | ||||
| @@ -278,9 +280,11 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| wxBillSettle.setApplyStatus(applyStatus); | wxBillSettle.setApplyStatus(applyStatus); | ||||
| wxBillSettleMapper.update(wxBillSettle); | wxBillSettleMapper.update(wxBillSettle); | ||||
| // 审批完成,账单解冻 | |||||
| //审批完成,账单解冻 | |||||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | ||||
| WxBillSettle settle = wxBillSettleService.getById(businessId); | |||||
| wxBillSettleService.updateFreeze(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode()); | |||||
| wxBillSettleService.updateFreeze(settle.getPayBillIds(),EnumFreezeType.DEF.getCode()); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -654,13 +654,13 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| long needpayAfter = 0; | long needpayAfter = 0; | ||||
| //同一天,算一天 | //同一天,算一天 | ||||
| if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | ||||
| needpayFront = getNeedPayMoney(wxPropertyContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); | |||||
| needpayFront = getNeedPayMoney(wxPropertyContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); | |||||
| }else{ | }else{ | ||||
| if(billTimeVo.getStartDate().before(endDate)){ | if(billTimeVo.getStartDate().before(endDate)){ | ||||
| needpayFront = getNeedPayMoney(wxPropertyContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate,Calendar.DATE,-1), i, billTimeVoList.size(), saveDb); | |||||
| needpayAfter = getNeedPayMoney(wxPropertyContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb); | |||||
| needpayFront = getNeedPayMoney(wxPropertyContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate,Calendar.DATE,-1), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||||
| needpayAfter = getNeedPayMoney(wxPropertyContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||||
| }else{ | }else{ | ||||
| needpayFront = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb); | |||||
| needpayFront = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||||
| } | } | ||||
| } | } | ||||
| needpay = needpayFront+needpayAfter; | needpay = needpayFront+needpayAfter; | ||||
| @@ -679,7 +679,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| //计算金额 | //计算金额 | ||||
| if(!flag){ | if(!flag){ | ||||
| needpay = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb); | |||||
| needpay = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); | |||||
| } | } | ||||
| WxBillProperty wxBillProperty = new WxBillProperty(); | WxBillProperty wxBillProperty = new WxBillProperty(); | ||||
| @@ -723,7 +723,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| public long getNeedPayMoney(WxPropertyContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb){ | |||||
| public long getNeedPayMoney(WxPropertyContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod){ | |||||
| long needpay; | long needpay; | ||||
| //按日 | //按日 | ||||
| if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | ||||
| @@ -739,7 +739,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| //生成金额直接计算 | //生成金额直接计算 | ||||
| if(!saveDb){ | if(!saveDb){ | ||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| return needpay; | return needpay; | ||||
| } | } | ||||
| @@ -754,7 +754,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| months++; | months++; | ||||
| needpay = new Double(months * priceD).longValue(); | needpay = new Double(months * priceD).longValue(); | ||||
| }else { | }else { | ||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| } | } | ||||
| }else if(i == 0){//第一期 | }else if(i == 0){//第一期 | ||||
| if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | ||||
| @@ -763,7 +763,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| months++; | months++; | ||||
| needpay = new Double(months * priceD).longValue(); | needpay = new Double(months * priceD).longValue(); | ||||
| }else{ | }else{ | ||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| } | } | ||||
| }else{ | }else{ | ||||
| if(isFirstDay(startDate)){ | if(isFirstDay(startDate)){ | ||||
| @@ -773,7 +773,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| needpay = new Double(months * priceD).longValue(); | needpay = new Double(months * priceD).longValue(); | ||||
| }else{ | }else{ | ||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| } | } | ||||
| } | } | ||||
| }else{//中间 | }else{//中间 | ||||
| @@ -1190,13 +1190,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| long needpayAfter = 0; | long needpayAfter = 0; | ||||
| //同一天,算一天 | //同一天,算一天 | ||||
| if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | ||||
| needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); | |||||
| needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); | |||||
| }else{ | }else{ | ||||
| if(billTimeVo.getStartDate().before(endDate)){ | if(billTimeVo.getStartDate().before(endDate)){ | ||||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate,Calendar.DATE,-1), i, billTimeVoList.size(), saveDb); | |||||
| needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb); | |||||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate,Calendar.DATE,-1), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||||
| needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||||
| }else{ | }else{ | ||||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb); | |||||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||||
| } | } | ||||
| } | } | ||||
| needpay = needpayFront+needpayAfter; | needpay = needpayFront+needpayAfter; | ||||
| @@ -1215,7 +1215,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| //计算金额 | //计算金额 | ||||
| if(!flag){ | if(!flag){ | ||||
| needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb); | |||||
| needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); | |||||
| } | } | ||||
| WxBillRent wxBillRent = new WxBillRent(); | WxBillRent wxBillRent = new WxBillRent(); | ||||
| @@ -1259,7 +1259,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb){ | |||||
| public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod){ | |||||
| long needpay; | long needpay; | ||||
| //按日 | //按日 | ||||
| if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | ||||
| @@ -1287,22 +1287,24 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| //生成金额直接计算 | //生成金额直接计算 | ||||
| if(!saveDb){ | if(!saveDb){ | ||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| return needpay; | return needpay; | ||||
| } | } | ||||
| SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | ||||
| SimpleDateFormat sdD = new SimpleDateFormat("d"); | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| if(i == billTimeVoListSize - 1){//最后 | if(i == billTimeVoListSize - 1){//最后 | ||||
| //判断是否满足整月 | //判断是否满足整月 | ||||
| int startInt = Integer.parseInt(sdD.format(startDate)); | |||||
| int endInt = Integer.parseInt(sdD.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))); | |||||
| if(startInt == endInt){ | |||||
| Calendar instance = Calendar.getInstance(); | |||||
| instance.setTime(startDate); | |||||
| instance.add(dayType, receivePeriod); | |||||
| instance.add(Calendar.DATE, -1); | |||||
| if(sd.format(instance.getTime()).equals(sd.format(endDate))){ | |||||
| int months = getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01"); | int months = getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01"); | ||||
| needpay = new Double(months * priceD).longValue(); | needpay = new Double(months * priceD).longValue(); | ||||
| }else{ | }else{ | ||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| } | } | ||||
| }else if(i == 0){//第一期 | }else if(i == 0){//第一期 | ||||
| if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | ||||
| @@ -1311,7 +1313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| months++; | months++; | ||||
| needpay = new Double(months * priceD).longValue(); | needpay = new Double(months * priceD).longValue(); | ||||
| }else{ | }else{ | ||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| } | } | ||||
| }else{ | }else{ | ||||
| if(isFirstDay(startDate)){ | if(isFirstDay(startDate)){ | ||||
| @@ -1321,7 +1323,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| needpay = new Double(months * priceD).longValue(); | needpay = new Double(months * priceD).longValue(); | ||||
| }else{ | }else{ | ||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue(); | |||||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||||
| } | } | ||||
| } | } | ||||
| }else{//中间 | }else{//中间 | ||||
| @@ -2169,7 +2171,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return wxRentContractMapper.getShopType(wxRentContract); | return wxRentContractMapper.getShopType(wxRentContract); | ||||
| } | } | ||||
| public static double getMonthNeedPay(Double price,Date start,Date end){ | |||||
| public static double getMonthNeedPay(Double price,Date start,Date end,int dayType,int receivePeriod){ | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | ||||
| SimpleDateFormat sdD = new SimpleDateFormat("d"); | SimpleDateFormat sdD = new SimpleDateFormat("d"); | ||||
| @@ -2192,10 +2194,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| //判断是否满足整月 | //判断是否满足整月 | ||||
| int startInt = Integer.parseInt(sdD.format(start)); | |||||
| int endInt = Integer.parseInt(sdD.format(DateUtils.getDaySet(end,Calendar.DATE,1))); | |||||
| if(startInt == endInt){ | |||||
| Calendar instance = Calendar.getInstance(); | |||||
| instance.setTime(start); | |||||
| instance.add(dayType, receivePeriod); | |||||
| instance.add(Calendar.DATE, -1); | |||||
| if(sd.format(instance.getTime()).equals(sd.format(end))){ | |||||
| int months = getMonths(sdM.format(start)+"-01",sdM.format(DateUtils.getDaySet(end,Calendar.DATE,1))+"-01"); | int months = getMonths(sdM.format(start)+"-01",sdM.format(DateUtils.getDaySet(end,Calendar.DATE,1))+"-01"); | ||||
| return (months) * price; | return (months) * price; | ||||
| } | } | ||||
| @@ -643,6 +643,8 @@ | |||||
| </select> | </select> | ||||
| <select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||
| select m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | select m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | ||||
| xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate, | xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate, | ||||
| @@ -686,6 +688,12 @@ | |||||
| select pay_amount money,mm.id from wx_profit_sharing_order pso | select pay_amount money,mm.id from wx_profit_sharing_order pso | ||||
| left join wx_merchant mm on pso.merchant_id=mm.id | left join wx_merchant mm on pso.merchant_id=mm.id | ||||
| where pso.sharing_status !=5 | where pso.sharing_status !=5 | ||||
| union all | |||||
| select merchant_id id,receive_pay money from wx_bill_rent_deposit where status = 3 | |||||
| union all | |||||
| select merchant_id id,receive_pay money from wx_bill_property_deposit where status = 3 | |||||
| union all | |||||
| select merchant_id id,receive_pay money from wx_bill_other_deposit where status = 3 | |||||
| )ss where ss.id = m.id | )ss where ss.id = m.id | ||||
| )/100,2) payOut, | )/100,2) payOut, | ||||
| @@ -729,6 +737,12 @@ | |||||
| select pay_amount money,mm.id from wx_profit_sharing_order pso | select pay_amount money,mm.id from wx_profit_sharing_order pso | ||||
| left join wx_merchant mm on pso.merchant_id=mm.id | left join wx_merchant mm on pso.merchant_id=mm.id | ||||
| where pso.sharing_status !=5 | where pso.sharing_status !=5 | ||||
| union all | |||||
| select merchant_id id,receive_pay money from wx_bill_rent_deposit where status = 3 | |||||
| union all | |||||
| select merchant_id id,receive_pay money from wx_bill_property_deposit where status = 3 | |||||
| union all | |||||
| select merchant_id id,receive_pay money from wx_bill_other_deposit where status = 3 | |||||
| )ss where ss.id = m.id | )ss where ss.id = m.id | ||||
| )/100,2)) balance | )/100,2)) balance | ||||
| @@ -26,13 +26,14 @@ | |||||
| <result column="starttime" property="starttime"/> | <result column="starttime" property="starttime"/> | ||||
| <result column="endtime" property="endtime"/> | <result column="endtime" property="endtime"/> | ||||
| <result column="freeze" property="freeze"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | ||||
| `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`, | `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`, | ||||
| `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime` | |||||
| `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -27,13 +27,14 @@ | |||||
| <result column="starttime" property="starttime"/> | <result column="starttime" property="starttime"/> | ||||
| <result column="endtime" property="endtime"/> | <result column="endtime" property="endtime"/> | ||||
| <result column="freeze" property="freeze"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | ||||
| `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | ||||
| `rent_shop_type`,`return_price`,`pay_way`,`starttime`,`endtime` | |||||
| `rent_shop_type`,`return_price`,`pay_way`,`starttime`,`endtime`,freeze | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -26,14 +26,14 @@ | |||||
| <result column="starttime" property="starttime"/> | <result column="starttime" property="starttime"/> | ||||
| <result column="endtime" property="endtime"/> | <result column="endtime" property="endtime"/> | ||||
| <result column="freeze" property="freeze"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | ||||
| `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | ||||
| `rent_shop_type`,`pay_way`,`starttime`,`endtime` | |||||
| `rent_shop_type`,`pay_way`,`starttime`,`endtime`,endtime | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -23,13 +23,13 @@ | |||||
| <result column="return_price" jdbcType="BIGINT" property="returnPrice"/> | <result column="return_price" jdbcType="BIGINT" property="returnPrice"/> | ||||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | ||||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | ||||
| <result column="freeze" property="freeze"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`, | `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`, | ||||
| `pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`return_price`,`shop_info`,`pay_way` | |||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`return_price`,`shop_info`,`pay_way`,freeze | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -40,6 +40,7 @@ | |||||
| <result column="late_pay_day" property="latePayDay"/> | <result column="late_pay_day" property="latePayDay"/> | ||||
| <result column="late_pay_ratio" property="latePayRatio"/> | <result column="late_pay_ratio" property="latePayRatio"/> | ||||
| <result column="freeze" property="freeze"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -47,7 +48,7 @@ | |||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | ||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | ||||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime | |||||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -43,6 +43,11 @@ | |||||
| <result column="late_pay_day" property="latePayDay"/> | <result column="late_pay_day" property="latePayDay"/> | ||||
| <result column="late_pay_ratio" property="latePayRatio"/> | <result column="late_pay_ratio" property="latePayRatio"/> | ||||
| <result column="freeze" property="freeze"/> | |||||
| <result column="bus_discount_ratio" property="busDiscountRatio"/> | |||||
| <result column="join_rent_price" property="joinRentPrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -50,7 +55,7 @@ | |||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | ||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | ||||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime,bus_discount_ratio | |||||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime,bus_discount_ratio,freeze,join_rent_price | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -100,7 +105,7 @@ | |||||
| r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | ||||
| d.receive_pay deposit,d.`status` | d.receive_pay deposit,d.`status` | ||||
| deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, | deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, | ||||
| r.late_pay_day,r.late_pay_ratio | |||||
| r.late_pay_day,r.late_pay_ratio,br.bus_discount_ratio | |||||
| from wx_bill_rent br | from wx_bill_rent br | ||||
| left join wx_shop s on br.shop_id=s.id | left join wx_shop s on br.shop_id=s.id | ||||
| left join wx_rent_contract r on br.rent_contract_id=r.id | left join wx_rent_contract r on br.rent_contract_id=r.id | ||||
| @@ -131,9 +131,21 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <include refid="dataRule"/> | |||||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||||
| and id in( | |||||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||||
| inner join wx_merchant m on ms.merchant_id = m.id | |||||
| inner join wx_shop s on s.id=ms.shop_id | |||||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and m.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test=" null != floorForRule and '' != floorForRule "> | |||||
| and s.`floor` in (${floorForRule}) | |||||
| </if> | |||||
| ) | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| @@ -141,7 +153,7 @@ | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_merchant | |||||
| from wx_merchant m | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -149,7 +149,7 @@ | |||||
| <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule "> | <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule "> | ||||
| and rc.`id` in | and rc.`id` in | ||||
| <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")"> | <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")"> | ||||
| select id from wx_rent_contract where tenant_id=#{tenantId} and | |||||
| select id from wx_property_contract where tenant_id=#{tenantId} and | |||||
| json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select | json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select | ||||
| id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | ||||
| </foreach> | </foreach> | ||||