| @@ -119,20 +119,21 @@ public class WxEnergyFees extends TenantEntity { | |||||
| } | } | ||||
| public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed,EnumRentDayPriceCalcute priceCalcute,Integer monthDays ) { | public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed,EnumRentDayPriceCalcute priceCalcute,Integer monthDays ) { | ||||
| if (isFixed) { | |||||
| return this.price; | |||||
| } | |||||
| if (StringUtils.isBlank(count)) { | |||||
| if (StringUtils.isBlank(count)) { | |||||
| count = "1"; | count = "1"; | ||||
| } | } | ||||
| if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.DAY.getCode().intValue()) { | |||||
| if (isFixed) { | |||||
| //如果是按计量单位计算的 | |||||
| BigDecimal priceD = new BigDecimal(this.price); | BigDecimal priceD = new BigDecimal(this.price); | ||||
| priceD = priceD.multiply(new BigDecimal(count)); | priceD = priceD.multiply(new BigDecimal(count)); | ||||
| return WxRentContractHelper.getNeedPay(decimalSize,new BigDecimal(0),priceD,start,end,priceCalcute,monthDays); | |||||
| }if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.ONECE.getCode().intValue()) { | |||||
| return priceD.toPlainString(); | |||||
| } | |||||
| if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.DAY.getCode().intValue()) { | |||||
| BigDecimal priceD = new BigDecimal(this.price); | BigDecimal priceD = new BigDecimal(this.price); | ||||
| priceD = priceD.multiply(new BigDecimal(count)); | priceD = priceD.multiply(new BigDecimal(count)); | ||||
| return priceD.toPlainString(); | |||||
| return WxRentContractHelper.getNeedPay(decimalSize,new BigDecimal(0),priceD,start,end,priceCalcute,monthDays); | |||||
| }else { | }else { | ||||
| //按月计算 | //按月计算 | ||||
| BigDecimal priceMonth = new BigDecimal(this.price); | BigDecimal priceMonth = new BigDecimal(this.price); | ||||
| @@ -208,5 +209,4 @@ public class WxEnergyFees extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer notSetOff; | private Integer notSetOff; | ||||
| } | } | ||||
| @@ -527,18 +527,24 @@ public class WxRentContract extends TenantEntity { | |||||
| return sb.toString(); | return sb.toString(); | ||||
| } | } | ||||
| public Map<Long,String> getDepositEnergyFees() { | |||||
| public Map<Long,WxEnergyFees> getDepositEnergyFees(Map<Long,WxEnergyFees> feesMap) { | |||||
| String dsdstr = this.getCashtypeContentLsit(); | String dsdstr = this.getCashtypeContentLsit(); | ||||
| if (!StringUtils.isBlank(dsdstr)) { | if (!StringUtils.isBlank(dsdstr)) { | ||||
| Map<Long,WxEnergyFees> retMap = new HashMap<Long,WxEnergyFees>(); | |||||
| JSONArray rentInfoArray = JSONArray.parseArray(dsdstr); | JSONArray rentInfoArray = JSONArray.parseArray(dsdstr); | ||||
| Map<Long,String> retMap = new HashMap<Long,String>(); | |||||
| int size = rentInfoArray.size(); | int size = rentInfoArray.size(); | ||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | ||||
| String depositType = rentInfoObject.getString("value"); | String depositType = rentInfoObject.getString("value"); | ||||
| String deposit = rentInfoObject.getString("deposit"); | String deposit = rentInfoObject.getString("deposit"); | ||||
| Long dt = Long.parseLong(depositType); | Long dt = Long.parseLong(depositType); | ||||
| retMap.put(dt, deposit); | |||||
| WxEnergyFees fees = feesMap.get(dt); | |||||
| WxEnergyFees nfees = new WxEnergyFees(); | |||||
| nfees.setId(fees.getId()); | |||||
| nfees.setName(fees.getName()); | |||||
| nfees.setCalcuteUnit(fees.getCalcuteUnit()); | |||||
| nfees.setPrice(deposit); | |||||
| retMap.put(dt, nfees); | |||||
| } | } | ||||
| return retMap; | return retMap; | ||||
| } | } | ||||
| @@ -88,7 +88,6 @@ public enum EnumBillAllType { | |||||
| retList.add(EnumFeesStandardsTimeUnit.DAY); | retList.add(EnumFeesStandardsTimeUnit.DAY); | ||||
| retList.add(EnumFeesStandardsTimeUnit.MONTH); | retList.add(EnumFeesStandardsTimeUnit.MONTH); | ||||
| retList.add(EnumFeesStandardsTimeUnit.YEAR); | retList.add(EnumFeesStandardsTimeUnit.YEAR); | ||||
| retList.add(EnumFeesStandardsTimeUnit.ONECE); | |||||
| return retList; | return retList; | ||||
| } | } | ||||
| } | } | ||||
| @@ -12,8 +12,7 @@ import com.iformall.utils.Constant; | |||||
| public enum EnumFeesStandardsTimeUnit { | public enum EnumFeesStandardsTimeUnit { | ||||
| DAY(1, "每日"), | DAY(1, "每日"), | ||||
| MONTH(2, "每月"), | MONTH(2, "每月"), | ||||
| YEAR(3,"每年"), | |||||
| ONECE(4,"单次"); | |||||
| YEAR(3,"每年"); | |||||
| public static EnumFeesStandardsTimeUnit getEnum(Integer code) { | public static EnumFeesStandardsTimeUnit getEnum(Integer code) { | ||||
| for (EnumFeesStandardsTimeUnit value : values()) { | for (EnumFeesStandardsTimeUnit value : values()) { | ||||
| @@ -946,29 +946,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | ||||
| if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) | if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) | ||||
| && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { | && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { | ||||
| //根据不同的科目生成不同的押金账单 | |||||
| Map<Long,String> feesMap = wxRentContract.getDepositEnergyFees(); | |||||
| WxEnergyFees fq = new WxEnergyFees(); | WxEnergyFees fq = new WxEnergyFees(); | ||||
| fq.updateTenantInfo(tenantEntity); | fq.updateTenantInfo(tenantEntity); | ||||
| fq.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); | fq.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); | ||||
| Map<Long,WxEnergyFees> typeMap = wxEnergyService.getFeesMap(fq); | Map<Long,WxEnergyFees> typeMap = wxEnergyService.getFeesMap(fq); | ||||
| //根据不同的科目生成不同的押金账单 | |||||
| Map<Long,WxEnergyFees> feesMap = wxRentContract.getDepositEnergyFees(typeMap); | |||||
| List<WxBillDeposit> insertList = new ArrayList<WxBillDeposit>(); | List<WxBillDeposit> insertList = new ArrayList<WxBillDeposit>(); | ||||
| for (Iterator<Long> it = feesMap.keySet().iterator();it.hasNext();){ | for (Iterator<Long> it = feesMap.keySet().iterator();it.hasNext();){ | ||||
| Long energyFeesId = it.next(); | Long energyFeesId = it.next(); | ||||
| String deposit = feesMap.get(energyFeesId); | |||||
| WxEnergyFees depositFee = feesMap.get(energyFeesId); | |||||
| WxEnergyFees fees = typeMap.get(energyFeesId); | WxEnergyFees fees = typeMap.get(energyFeesId); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| WxBillDeposit wxBillDeposit = new WxBillDeposit(); | WxBillDeposit wxBillDeposit = new WxBillDeposit(); | ||||
| wxBillDeposit.setId(idWorker.nextId()); | wxBillDeposit.setId(idWorker.nextId()); | ||||
| wxBillDeposit.setRentContractId(wxRentContract.getId()); | wxBillDeposit.setRentContractId(wxRentContract.getId()); | ||||
| if (null != fees) { | if (null != fees) { | ||||
| wxBillDeposit.setContractDepoistDetail("合同押金项["+fees.getName()+"]"+deposit+"元"); | |||||
| wxBillDeposit.setContractDepoistDetail("合同押金项["+fees.getName()+"]"+depositFee.getPrice()+"元"+"/"+fees.getCalcuteUnitName()); | |||||
| } | } | ||||
| wxBillDeposit.setPay("0"); | wxBillDeposit.setPay("0"); | ||||
| //String needpay = wxRentContract.getDeposit(); | //String needpay = wxRentContract.getDeposit(); | ||||
| String needpay = deposit; | |||||
| String needpay = depositFee.calcuteTotalMoney(wxRentContract.getDecimalSize(), null, null, "1", true, null, null); | |||||
| wxBillDeposit.setReceivePay(needpay); | wxBillDeposit.setReceivePay(needpay); | ||||
| wxBillDeposit.setNeedPay(needpay); | wxBillDeposit.setNeedPay(needpay); | ||||
| //wxBillDeposit.setOwe(needpay); | //wxBillDeposit.setOwe(needpay); | ||||