From a819cf9442c5105d9cfeb2f55aed0beb7af7d6f1 Mon Sep 17 00:00:00 2001 From: winter <664946893@qq.com> Date: Mon, 11 Nov 2024 10:37:07 +0800 Subject: [PATCH] fix --- .../WxPropertyContractController.java | 16 -- .../domain/po/WxPropertyContract.java | 3 + .../service/WxPropertyContractService.java | 2 - .../impl/WxPropertyContractServiceImpl.java | 117 ++++++------ .../impl/WxRentContractServiceImpl.java | 168 +++++++++++------- 5 files changed, 164 insertions(+), 142 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java index e1c1c3e7d..0dad4cdfe 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java @@ -542,21 +542,5 @@ public class WxPropertyContractController extends WxContractBaseController { return new ResultData(); } - /** - * 预览账单展示,编辑账期,后端生成账单金额 - * @param wxPropertyContract - * @return - */ - @PostMapping("buildBillPriceList") - public ResultData buildBillPriceList(@RequestBody WxPropertyContract wxPropertyContract) throws Exception{ - logger.debug("[" + getIpAddr() + "] WxRentContractController::buildBillPriceList"); - WxPropertyContract dbRent = wxPropertyContractMapper.selectById(wxPropertyContract.getId()); - dbRent.setPreviewBillRentList(wxPropertyContract.getPreviewBillRentList()); - if(dbRent.getRentStartType()!=null && dbRent.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ - dbRent.setRentalStartDate(dbRent.getStartDate()); - } - List result = wxPropertyContractService.buildProperty(new WxMerchant(),getUser(),dbRent, EnumIsPreview.YES.getCode(), false); - return new ResultData(result); - } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index 103c30682..a5382d3f7 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -366,5 +366,8 @@ public class WxPropertyContract extends TenantEntity { @TableField(exist = false) private Long queryShopId; + + @TableField(exist = false) + private String shopIds; } diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java index 979173f26..be8b795ce 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java @@ -65,8 +65,6 @@ public interface WxPropertyContractService { List getWxBillPropertyPreview(TenantEntity tenantEntity,Long id); - List buildProperty(WxMerchant wxMerchant, MallUserInfo user, WxPropertyContract propertyContract, Integer isPreview,boolean saveDb); - WxPropertyContract getByBill(WxAllBill billRent); ResultData apply(WxPropertyContract wxPropertyContract,MallUserInfo user); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 8db523d59..c0cc3c2a3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -23,6 +23,8 @@ import com.iformall.service.helper.WxBillAllHelper; import com.iformall.service.helper.WxRentContractHelper; import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; + +import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -36,6 +38,7 @@ import org.springframework.util.CollectionUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.HttpURLConnection; @@ -412,7 +415,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService record.setCreateType(wxPropertyContract.getCreateType()); record.setShopIdStr(wxPropertyContract.getShopIdStr()); record.setFeeStandards(wxPropertyContract.getFeesStardarsList()); - List billList = buildProperty(new WxMerchant(),user,record,EnumIsPreview.YES.getCode(),true); + List billList = buildProperty(user,record,EnumIsPreview.YES.getCode(),true); record.setPreviewBillRentList(billList); } @@ -663,6 +666,12 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if(yearList.size() > 1){ endDate = yearList.get(1); } + + List shopIdList = wxPropertyContract.shopIdsByShop(); + Map shopAreaRateMap = wxPropertyContract.getRentShopAreaRate(); + if (null == shopAreaRateMap) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); + } List billTimeVoList = new ArrayList<>(); if(saveDb){ @@ -797,7 +806,47 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //批量生成预账单 if(saveDb && allResultList.size() > 0 ) { - wxAllBillMapper.insertBills(wxPropertyContract.getTenantId() ,allResultList); + + WxShopUsers suq = new WxShopUsers(); + suq.updateTenantInfo(wxPropertyContract); + suq.setShopIds(shopIdList); + suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); + Map shopUserMap = wxShopService.getShopUserMap(suq); + + final IdWorker idWorker = IdWorker.get(); + //根据店铺来拆分 + List shopAllBillList = new ArrayList(); + for (int i = 0 ; i < allResultList.size(); i++ ) { + WxAllBill rb = allResultList.get(i); + for (int g = 0 ; g < shopIdList.size(); g ++ ){ + WxAllBill rs = new WxAllBill(); + Long sid = shopIdList.get(g); + BigDecimal shoprate = shopAreaRateMap.get(sid); + try { + BeanUtils.copyProperties(rs, rb); + rs.setId(idWorker.nextId()); + rs.setShopId(sid); + rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).toPlainString()); + rs.setReceivePay(rs.getNeedPay()); + rs.setShopId(sid); + if (null != shopUserMap ) { + WxShopUsers wsu = shopUserMap.get(sid); + if (null != wsu) { + rs.setCusName(wsu.getName()); + } + }; + shopAllBillList.add(rs); + } catch (IllegalAccessException e) { + logger.error("saveBill error.",e); + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); + } catch (InvocationTargetException e) { + logger.error("saveBill error.",e); + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); + } + } + } + + wxAllBillMapper.insertBills(wxPropertyContract.getTenantId() ,shopAllBillList); //for (int i = 0 ; i < resultList.size() ; i++) { // wxBillPropertyMapper.insert(resultList.get(i)); //} @@ -851,7 +900,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService Date date = new Date(); //setExpiredDay(wxBillProperty,dayType,receivePeriod); wxBillProperty.updateTenantInfo(wxPropertyContract); - wxBillProperty.setMerchantId(wxPropertyContract.getMerchantId()); //wxBillProperty.setUserId(user.getId()); //wxBillProperty.setShopId(wxPropertyContract.getShopId()); wxBillProperty.setCreatetime(date); @@ -865,7 +913,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if (shopInfo != null) { wxBillProperty.setShopInfo(JSONObject.toJSONString(shopInfo)); } - wxBillProperty.setShopNumber(wxPropertyContract.getShopNumbers()); wxBillProperty.setRentArea(wxPropertyContract.getRentArea()); //wxBillProperty.setLatePayRatio(0); wxBillProperty.setTotalFee(new BigDecimal(needpay).add(new BigDecimal(standarsTotal)).toPlainString()); @@ -936,28 +983,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return needpay; } -// public void setExpiredDay(WxBillProperty wxBillProperty,int dayType, int receivePeriod){ -// Date date = new Date(); -// wxBillProperty.setExpiredDay(0L); -// if (wxBillProperty.getReceiveDate().before(date)) { -// long day = (date.getTime() - wxBillProperty.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); -// wxBillProperty.setStatus(EnumBillStatus.NOT_PAID.getCode()); -// if (day > 0) { -// wxBillProperty.setExpiredDay(day); -// } -// } else {//截止收租日在当前时间之后 -// Calendar now = Calendar.getInstance(); -// now.add(dayType, receivePeriod); -// Date currenttime = now.getTime(); -// //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 -// if (currenttime.before(wxBillProperty.getReceiveDate())) { -// wxBillProperty.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); -// } else { -// wxBillProperty.setStatus(EnumBillStatus.WAIT_PAY.getCode()); -// } -// } -// } - public boolean isFirstDay(Date date){ int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date)); if(dateInt == 1){ @@ -972,37 +997,21 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService * @param propertyContract * @return */ - @Override //@Transactional(rollbackFor = {Exception.class}) - public List buildProperty(WxMerchant wxMerchant,MallUserInfo user,WxPropertyContract propertyContract,Integer isPreview,boolean saveDb) { + public List buildProperty(MallUserInfo user,WxPropertyContract propertyContract,Integer isPreview,boolean saveDb) { List result = new ArrayList(); - WxPropertyContract wxPropertyContract; - if(propertyContract == null){ - //根据商户ID找出合同 - wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.setMerchantId(wxMerchant.getId()); - List list = wxPropertyContractMapper.findList(wxPropertyContract); - if (list.size() > 0) { - wxPropertyContract = list.get(0); - } - }else{ - wxPropertyContract = propertyContract; + int receivePeriod = propertyContract.getReceivePeriod().intValue(); + Integer lease = propertyContract.getLease(); + Date rentalStartDate = propertyContract.getRentalStartDate(); + if (EnumRentStartType.STARTTIME.getCode().equals(propertyContract.getRentStartType())) { + rentalStartDate = propertyContract.getStartDate(); } + propertyContract.setRentalStartDate(rentalStartDate); + String price = propertyContract.getPrice(); - if (wxPropertyContract != null) { - int receivePeriod = wxPropertyContract.getReceivePeriod().intValue(); - Integer lease = wxPropertyContract.getLease(); - Date rentalStartDate = wxPropertyContract.getRentalStartDate(); - if (EnumRentStartType.STARTTIME.getCode().equals(wxPropertyContract.getRentStartType())) { - rentalStartDate = wxPropertyContract.getStartDate(); - } - propertyContract.setRentalStartDate(rentalStartDate); - String price = propertyContract.getPrice(); - - //按月计租 - result = buildRentMonth(user, propertyContract, receivePeriod, lease, rentalStartDate,isPreview,saveDb); - } + //按月计租 + result = buildRentMonth(user, propertyContract, receivePeriod, lease, rentalStartDate,isPreview,saveDb); //for (int i = 0; i < result.size(); i++) { // result.get(i).setPeriod(i+1); //} @@ -1135,10 +1144,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return new ResultData(Result.ERROR, "编号["+record.getId()+"]租金合同没有审批流程."); } - if (rentContract.getMerchantId() == null) { - return new ResultData(Result.ERROR, "编号["+record.getId()+"]租金合同没有绑定商户."); - } - if ((EnumRentContractStatus.DRAFT.getCode().intValue() == rentContract.getStatus().intValue()) || (EnumRentContractStatus.PERFORMANCE.getCode().intValue() == rentContract.getStatus().intValue() && (EnumRentContractAppStatus.REJECT.getCode().intValue() == rentContract.getApplyStatus().intValue() || diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 08a9e701e..14d63d4eb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -28,6 +28,7 @@ import com.iformall.domain.po.WxRentContractFreePeriod; import com.iformall.domain.po.WxRentContractRevenueJump; import com.iformall.domain.po.WxRentContractRevenueSales; import com.iformall.domain.po.WxShop; +import com.iformall.domain.po.WxShopUsers; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.BillTimeVo; import com.iformall.domain.vo.RatioVo; @@ -61,6 +62,7 @@ import com.iformall.enums.EnumRentContractType; import com.iformall.enums.EnumRentDayPriceCalcute; import com.iformall.enums.EnumRentShopType; import com.iformall.enums.EnumRentStartType; +import com.iformall.enums.EnumShopUsersStatus; import com.iformall.enums.EnumTradeDailyDateType; import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; @@ -1438,6 +1440,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { //批量插入账单 if(saveDb) { + + WxShopUsers suq = new WxShopUsers(); + suq.updateTenantInfo(wxRentContract); + suq.setShopIds(shopIdList); + suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); + Map shopUserMap = wxShopService.getShopUserMap(suq); + List rblist = new ArrayList(); for (int k = 0 ; k < resultList.size(); k++) { WxAllBill rb = resultList.get(k); @@ -1451,6 +1460,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { rs.setShopId(sid); rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).toPlainString()); rs.setReceivePay(rs.getNeedPay()); + rs.setShopId(sid); + if (null != shopUserMap ) { + WxShopUsers wsu = shopUserMap.get(sid); + if (null != wsu) { + rs.setCusName(wsu.getName()); + } + } rblist.add(rs); } catch (IllegalAccessException e) { logger.error("savePreviewBill error.",e); @@ -1476,6 +1492,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { rs.setShopId(sid); rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).toPlainString()); rs.setReceivePay(rs.getNeedPay()); + rs.setShopId(sid); + if (null != shopUserMap ) { + WxShopUsers wsu = shopUserMap.get(sid); + if (null != wsu) { + rs.setCusName(wsu.getName()); + } + } mblist.add(rs); } catch (IllegalAccessException e) { logger.error("savePreviewBill error.",e); @@ -1514,6 +1537,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { manage.setRentArea(wxBillRent.getRentArea()); manage.setShopNumber(wxBillRent.getShopNumber()); manage.setCanEdit(EnumYesOrNo.NO.getCode()); + manage.setCusName(wxBillRent.getCusName()); if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode().intValue()){ manage.setEnergyFeesId(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId()); manage.setBillType(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); @@ -2727,12 +2751,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { }else { rentBill = generateRentBill(rentcontract,rentneedpay,rentRate,rentStartDate,rentEndDate,createFrom); } + + List shopIdList = rentcontract.shopIdsByRentInfo(); + WxShopUsers suq = new WxShopUsers(); + suq.updateTenantInfo(rentcontract); + suq.setShopIds(shopIdList); + suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); + Map shopUserMap = wxShopService.getShopUserMap(suq); + //物业账单应收就改为0,因为金额已经合并了 - WxAllBill propeBill = generatePropertyBill(rentcontract, propertyContractId, rentBill,propertyBill, needpay, propertyRate,createFrom); + WxAllBill propeBill = generatePropertyBill(shopIdList,shopUserMap,rentcontract, propertyContractId, rentBill,propertyBill, needpay, propertyRate,createFrom); - WxAllBill bmbill = generateManageBill(rentcontract, rentBill, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom); + WxAllBill bmbill = generateManageBill(shopIdList,shopUserMap,rentcontract, rentBill, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom); - WxAllBill ombill = generateManageBill(rentcontract, rentBill, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom); + WxAllBill ombill = generateManageBill(shopIdList,shopUserMap,rentcontract, rentBill, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom); WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); vo.setTotal(needpay); @@ -2752,7 +2784,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public WxAllBill generateManageBill(WxRentContract rentcontract,WxAllBill rentBill,String total,String rate,EnumBillAllType type,EnumBillExtraCreateFrom createFrom) { + public WxAllBill generateManageBill(List shopIds,Map shopUserMap,WxRentContract rentcontract,WxAllBill rentBill,String total,String rate,EnumBillAllType type,EnumBillExtraCreateFrom createFrom) { //商业管理费,营运管理费应收改为0,因为金额已经合并了 WxAllBill bussinessmanageBill = new WxAllBill(); bussinessmanageBill.updateTenantInfo(rentcontract); @@ -2840,76 +2872,76 @@ public class WxRentContractServiceImpl implements WxRentContractService { return bmbill; } - private WxAllBill generatePropertyBill(WxRentContract rentcontract,Long propertyContractId,WxAllBill rentBill,WxAllBill propertyBill,String total,String rate,EnumBillExtraCreateFrom createFrom) { -// String bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); -// if (null != propertyBill ) { -// propertyBill.setMoneyChangeDetail("原合同商业管理费金额:"+propertyBill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。"); -// propertyBill.setReceivePay(bussinessmoney); -// propertyBill.setBillRemark(createFrom.getMessage()+",自动计算"+"原合同商业管理费金额:"+propertyBill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。"); -// if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { -// //propertyBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); -// }else { -// //bmbill.setStatus(EnumBillStatus.PAID.getCode()); -// } -// propertyBill.setUpdatetime(new Date()); -// wxAllBillMapper.updateById(propertyBill); -// return propertyBill; -// }else { -// if (new BigDecimal(bussinessmoney).compareTo(new BigDecimal(0)) > 0 ) { -// WxAllBill bmbill = new WxAllBill(); -// final IdWorker idWorker = IdWorker.get(); -// bmbill.setId(idWorker.nextId()); -// bmbill.updateTenantInfo(rentcontract); -// bmbill.setBillType(EnumBillAllType.PROPERTY.getCode()); -// bmbill.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); -// bmbill.setRentContractId(rentcontract.getId()); -// bmbill.setPropertyContractId(propertyContractId); -// bmbill.setIsPreview(EnumYesOrNo.NO.getCode()); -// bmbill.setCanEdit(EnumYesOrNo.NO.getCode()); -// bmbill.setMerchantId(rentcontract.getMerchantId()); -// bmbill.setCreatetime(new Date()); -// bmbill.setUpdatetime(new Date()); -// bmbill.setPriceDetail(""); -// bmbill.setNeedPay(bussinessmoney); -// bmbill.setReceivePay(bussinessmoney); -// bmbill.setPay("0"); -// bmbill.setStarttime(rentBill.getStarttime()); -// bmbill.setEndtime(rentBill.getEndtime()); -// bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,总计分摊比率为:"+rate); -// bmbill.setExtraCreateFrom(createFrom.getCode()); -// bmbill.setMoneyChangeDetail("自动计算创建,总计分摊比率为:"+rate+",应收金额为:"+bussinessmoney+"元,"); -// wxAllBillMapper.insert(bmbill); -// return bmbill; -// } -// return null; -// } + private WxAllBill generatePropertyBill(List shopIds,Map shopUserMap,WxRentContract rentcontract,Long propertyContractId,WxAllBill rentBill,WxAllBill propertyBill,String total,String rate,EnumBillExtraCreateFrom createFrom) { + String bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); + if (null != propertyBill ) { + propertyBill.setMoneyChangeDetail("原合同商业管理费金额:"+propertyBill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。"); + propertyBill.setReceivePay(bussinessmoney); + propertyBill.setBillRemark(createFrom.getMessage()+",自动计算"+"原合同商业管理费金额:"+propertyBill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。"); + if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { + //propertyBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); + }else { + //bmbill.setStatus(EnumBillStatus.PAID.getCode()); + } + propertyBill.setUpdatetime(new Date()); + wxAllBillMapper.updateById(propertyBill); + return propertyBill; + }else { + if (new BigDecimal(bussinessmoney).compareTo(new BigDecimal(0)) > 0 ) { + WxAllBill bmbill = new WxAllBill(); + final IdWorker idWorker = IdWorker.get(); + bmbill.setId(idWorker.nextId()); + bmbill.updateTenantInfo(rentcontract); + bmbill.setBillType(EnumBillAllType.PROPERTY.getCode()); + bmbill.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); + bmbill.setRentContractId(rentcontract.getId()); + bmbill.setPropertyContractId(propertyContractId); + bmbill.setIsPreview(EnumYesOrNo.NO.getCode()); + bmbill.setCanEdit(EnumYesOrNo.NO.getCode()); + bmbill.setMerchantId(rentcontract.getMerchantId()); + bmbill.setCreatetime(new Date()); + bmbill.setUpdatetime(new Date()); + bmbill.setPriceDetail(""); + bmbill.setNeedPay(bussinessmoney); + bmbill.setReceivePay(bussinessmoney); + bmbill.setPay("0"); + bmbill.setStarttime(rentBill.getStarttime()); + bmbill.setEndtime(rentBill.getEndtime()); + bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,总计分摊比率为:"+rate); + bmbill.setExtraCreateFrom(createFrom.getCode()); + bmbill.setMoneyChangeDetail("自动计算创建,总计分摊比率为:"+rate+",应收金额为:"+bussinessmoney+"元,"); + wxAllBillMapper.insert(bmbill); + return bmbill; + } + return null; + } return null; } private WxAllBill generateRentBill(WxRentContract rentcontract,String money,String rate,Date starttime,Date endtime,EnumBillExtraCreateFrom createFrom) { WxAllBill bmbill = new WxAllBill(); -// final IdWorker idWorker = IdWorker.get(); -// bmbill.setId(idWorker.nextId()); -// bmbill.updateTenantInfo(rentcontract); -// bmbill.setBillType(EnumBillAllType.RENT.getCode()); -// bmbill.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); -// bmbill.setRentContractId(rentcontract.getId()); -// bmbill.setIsPreview(EnumYesOrNo.NO.getCode()); -// bmbill.setCanEdit(EnumYesOrNo.NO.getCode()); -// bmbill.setMerchantId(rentcontract.getMerchantId()); -// bmbill.setCreatetime(new Date()); -// bmbill.setUpdatetime(new Date()); -// bmbill.setPriceDetail(""); -// bmbill.setNeedPay(money); -// bmbill.setReceivePay(money); -// bmbill.setPay("0"); -// bmbill.setStarttime(starttime); -// bmbill.setEndtime(endtime); -// bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,分摊比例为"+rate); -// bmbill.setExtraCreateFrom(createFrom.getCode()); -// bmbill.setMoneyChangeDetail("自动计算创建,分摊比例为"+rate+",计算应收金额为:"+money+"元,"); -// wxAllBillMapper.insert(bmbill); + final IdWorker idWorker = IdWorker.get(); + bmbill.setId(idWorker.nextId()); + bmbill.updateTenantInfo(rentcontract); + bmbill.setBillType(EnumBillAllType.RENT.getCode()); + bmbill.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); + bmbill.setRentContractId(rentcontract.getId()); + bmbill.setIsPreview(EnumYesOrNo.NO.getCode()); + bmbill.setCanEdit(EnumYesOrNo.NO.getCode()); + bmbill.setMerchantId(rentcontract.getMerchantId()); + bmbill.setCreatetime(new Date()); + bmbill.setUpdatetime(new Date()); + bmbill.setPriceDetail(""); + bmbill.setNeedPay(money); + bmbill.setReceivePay(money); + bmbill.setPay("0"); + bmbill.setStarttime(starttime); + bmbill.setEndtime(endtime); + bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,分摊比例为"+rate); + bmbill.setExtraCreateFrom(createFrom.getCode()); + bmbill.setMoneyChangeDetail("自动计算创建,分摊比例为"+rate+",计算应收金额为:"+money+"元,"); + wxAllBillMapper.insert(bmbill); return bmbill; }