Browse Source

fix

release_toaliyun_real
winter 1 year ago
parent
commit
1458fa40c0
1 changed files with 53 additions and 25 deletions
  1. +53
    -25
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 53
- 25
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -2793,14 +2793,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
suq.setShopIds(shopIdList);
suq.setStatus(EnumShopUsersStatus.LIVE.getCode());
Map<Long,WxShopUsers> shopUserMap = wxShopService.getShopUserMap(suq);
WxShop sq = new WxShop();
sq.updateTenantInfo(sq);
sq.setIds(shopIdList);
Map<Long, WxShop> shopMap = wxShopService.findShopMap(sq);
List<WxAllBill> rentBill = generateRentBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract,rentBillList,rentneedpay,rentRate,startDate,endDate,createFrom);
List<WxAllBill> rentBill = generateRentBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract,rentBillList,rentneedpay,rentRate,startDate,endDate,createFrom);
List<WxAllBill> propeBill = generatePropertyBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract, propertyContractId,propertyBillList,startDate,endDate, needpay, propertyRate,createFrom);
List<WxAllBill> propeBill = generatePropertyBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, propertyContractId,propertyBillList,startDate,endDate, needpay, propertyRate,createFrom);
List<WxAllBill> bmbill = generateManageBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom);
List<WxAllBill> bmbill = generateManageBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom);
List<WxAllBill> ombill = generateManageBill(user,shopIdList,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom);
List<WxAllBill> ombill = generateManageBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom);
WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo();
vo.setTotal(needpay);
@@ -2820,7 +2824,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public List<WxAllBill> generateManageBill(MallUserInfo user,List<Long> shopIds,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract,
public List<WxAllBill> generateManageBill(MallUserInfo user,List<Long> shopIds,Map<Long, WxShop> shopMap,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract,
Date starttime, Date endtime,String total,String rate,EnumBillAllType type,EnumBillExtraCreateFrom createFrom) {
WxAllBill bussinessmanageBill = new WxAllBill();
bussinessmanageBill.updateTenantInfo(rentcontract);
@@ -2832,12 +2836,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bussinessmanageBill.setStarttimeEqual(starttime);
bussinessmanageBill.setEndtimeEqual(endtime);
List<WxAllBill> bmbillList = wxAllBillMapper.findList(bussinessmanageBill);
String bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString();
BigDecimal bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
if (null != bmbillList && bmbillList.size() > 0 ) {
//查询每一个铺位的
for (int i = 0 ; i < bmbillList.size() ; i ++) {
WxAllBill b = bmbillList.get(i);
//把原有的账单应收金额变为0
b.setNeedPay("0");//如不设置会影响减免统计
b.setReceivePay("0");
b.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0");
b.setUpdatetime(new Date());
@@ -2846,14 +2851,14 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxAllBillMapper.updateById(b);
}
}
if (new BigDecimal(bussinessmoney).compareTo(new BigDecimal(0)) > 0 ) {
if (bussinessmoney.compareTo(new BigDecimal(0)) > 0 ) {
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < shopIds.size(); i++) {
Long sid = shopIds.get(i);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String newmoney = new BigDecimal(bussinessmoney).multiply(shoprate).setScale(rentcontract.getDecimalSize()).toPlainString();
String newmoney = bussinessmoney.multiply(shoprate).setScale(rentcontract.getDecimalSize()).toPlainString();
WxAllBill b = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
b.setId(idWorker.nextId());
@@ -2886,10 +2891,16 @@ public class WxRentContractServiceImpl implements WxRentContractService {
b.setEndtime(endtime);
b.setReceiveDate(starttime);
b.setPeriod(WxRentContractHelper.getPeriod(starttime));
b.setBillRemark(createFrom.getMessage()+"自动计算创建,科目总计分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString());
b.setBillRemark(createFrom.getMessage()+"自动计算创建,科目总应收金额为:"+bussinessmoney.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()+"元[科目分摊比率为:"+rate+"]。"+"本铺分担比例"+shoprate.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toEngineeringString());
b.setExtraCreateFrom(createFrom.getCode());
b.setMoneyChangeDetail("自动计算创建,科目总计分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString());
b.setMoneyChangeDetail("自动计算创建,科目总应收金额为:"+bussinessmoney.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()+"元[科目分摊比率为:"+rate+"]。"+"本铺分担比例"+shoprate.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toEngineeringString());
wxAllBillMapper.insert(b);
if (null != shopMap) {
WxShop s = shopMap.get(sid);
if ( null != s) {
b.setShopNumber(s.getShopNumber());
}
}
billList.add(b);
}
return billList;
@@ -2899,14 +2910,15 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public List<WxAllBill> generatePropertyBill(MallUserInfo user,List<Long> shopIds,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract,
public List<WxAllBill> generatePropertyBill(MallUserInfo user,List<Long> shopIds,Map<Long, WxShop> shopMap,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract,
Long propertyContractId,List<WxAllBill> propertyBillList,Date starttime,Date endtime,String total,String rate,EnumBillExtraCreateFrom createFrom) {
String bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString();
BigDecimal bussinessmoney = new BigDecimal(total).multiply(new BigDecimal(rate)).setScale(Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
if (null != propertyBillList ) {
if (null != propertyBillList) {
for (int i = 0 ; i < propertyBillList.size(); i++){
WxAllBill _rb = propertyBillList.get(i);
//把原有的账单应收金额变为0
_rb.setNeedPay("0");
_rb.setReceivePay("0");
_rb.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0");
_rb.setUpdatetime(new Date());
@@ -2916,13 +2928,14 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
}
if (new BigDecimal(bussinessmoney).compareTo(new BigDecimal(0)) > 0 ) {
if (bussinessmoney.compareTo(new BigDecimal(0)) > 0 ) {
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < shopIds.size() ; i ++) {
Long sid = shopIds.get(i);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String newmoney = bussinessmoney.multiply(shoprate).setScale(rentcontract.getDecimalSize()).toPlainString();
WxAllBill bmbill = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
bmbill.setId(idWorker.nextId());
@@ -2949,17 +2962,23 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bmbill.setUpdateBy(user.getId());
bmbill.setUpdateByName(user.getName());
bmbill.setPriceDetail("");
bmbill.setNeedPay(bussinessmoney);
bmbill.setReceivePay(bussinessmoney);
bmbill.setNeedPay(newmoney);
bmbill.setReceivePay(newmoney);
bmbill.setPay("0");
bmbill.setStarttime(starttime);
bmbill.setEndtime(endtime);
bmbill.setReceiveDate(starttime);
bmbill.setPeriod(WxRentContractHelper.getPeriod(starttime));
bmbill.setBillRemark(createFrom.getMessage()+".自动计算创建,科目分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString());
bmbill.setBillRemark(createFrom.getMessage()+".自动计算创建,科目总应收金额为:"+bussinessmoney.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()+"元[科目分摊比率为:"+rate+"]。"+"本铺分担比例"+shoprate.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toEngineeringString());
bmbill.setExtraCreateFrom(createFrom.getCode());
bmbill.setMoneyChangeDetail("自动计算创建,科目分摊比率为:"+rate+",总应收金额为:"+bussinessmoney+"元,"+",本铺分担比例"+shoprate.toEngineeringString());
bmbill.setMoneyChangeDetail("自动计算创建,科目总应收金额为:"+bussinessmoney.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()+"元[科目分摊比率为:"+rate+"]。"+"本铺分担比例"+shoprate.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toEngineeringString());
wxAllBillMapper.insert(bmbill);
if (null != shopMap) {
WxShop s = shopMap.get(sid);
if ( null != s) {
bmbill.setShopNumber(s.getShopNumber());
}
}
billList.add(bmbill);
}
return billList;
@@ -2969,7 +2988,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public List<WxAllBill> generateRentBill(MallUserInfo user,List<Long> shopIds,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract,
public List<WxAllBill> generateRentBill(MallUserInfo user,List<Long> shopIds,Map<Long, WxShop> shopMap,Map<Long,WxShopUsers> shopUserMap,Map<Long, BigDecimal> shopAreaRateMap,WxRentContract rentcontract,
List<WxAllBill> rentBillList,String money,String rate,Date starttime,Date endtime,EnumBillExtraCreateFrom createFrom) {
//rentBillList , 如果是多个房间,则就有几个租金账单
if (null != rentBillList && rentBillList.size() > 0 ) {
@@ -2977,6 +2996,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int i = 0 ; i < rentBillList.size() ; i ++) {
WxAllBill b = rentBillList.get(i);
//把原有的账单应收金额变为0
b.setNeedPay("0");//如不设置会影响减免统计
b.setReceivePay("0");
b.setBillRemark("账单金额重新计算生成新账单,原账单金额变为0");
b.setUpdatetime(new Date());
@@ -2985,12 +3005,14 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxAllBillMapper.updateById(b);
}
}
BigDecimal moneyb = new BigDecimal(money);
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < shopIds.size(); i++) {
Long sid = shopIds.get(i);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String newmoney = moneyb.multiply(shoprate).setScale(rentcontract.getDecimalSize()).toPlainString();
WxAllBill bmbill = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
bmbill.setId(idWorker.nextId());
@@ -3016,17 +3038,23 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bmbill.setUpdateBy(user.getId());
bmbill.setUpdateByName(user.getName());
bmbill.setPriceDetail("");
bmbill.setNeedPay(new BigDecimal(money).multiply(shoprate).toPlainString());
bmbill.setNeedPay(newmoney);
bmbill.setReceivePay(bmbill.getNeedPay());
bmbill.setPay("0");
bmbill.setStarttime(starttime);
bmbill.setEndtime(endtime);
bmbill.setReceiveDate(starttime);
bmbill.setPeriod(WxRentContractHelper.getPeriod(starttime));
bmbill.setBillRemark(createFrom.getMessage()+".自动计算创建,科目分摊比例为"+rate+",计算总应收金额为:"+money+"元,"+",本铺分担比例"+shoprate.toEngineeringString());
bmbill.setBillRemark(createFrom.getMessage()+".自动计算创建,科目总应收金额为:"+moneyb.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()+"元[科目分摊比率为:"+rate+"]。"+"本铺分担比例"+shoprate.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toEngineeringString());
bmbill.setExtraCreateFrom(createFrom.getCode());
bmbill.setMoneyChangeDetail("自动计算创建,科目分摊比例为"+rate+",计算总应收金额为:"+money+"元,"+",本铺分担比例"+shoprate.toEngineeringString());
bmbill.setMoneyChangeDetail("自动计算创建,自动计算创建,科目总应收金额为:"+moneyb.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()+"元[科目分摊比率为:"+rate+"]。"+"本铺分担比例"+shoprate.setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toEngineeringString());
wxAllBillMapper.insert(bmbill);
if (null != shopMap) {
WxShop s = shopMap.get(sid);
if ( null != s) {
bmbill.setShopNumber(s.getShopNumber());
}
}
billList.add(bmbill);
}
return billList;


Loading…
Cancel
Save