winter 1 год назад
Родитель
Сommit
7102e3280a
3 измененных файлов: 64 добавлений и 34 удалений
  1. +2
    -11
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  2. +37
    -10
      mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java
  3. +25
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 2
- 11
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java Просмотреть файл

@@ -474,7 +474,7 @@ public class WxRentContract extends TenantEntity {
return sb.toString();
}
public Map<Long,BigDecimal> getRentShopAreaRate() {
public Map<Long,BigDecimal> getRentShopArea() {
String rentInfo = this.getRentInfo();
if (!StringUtils.isBlank(rentInfo)) {
Map<Long,BigDecimal> shopAreaMap = new HashMap<Long,BigDecimal>();
@@ -492,16 +492,7 @@ public class WxRentContract extends TenantEntity {
total = total.add(new BigDecimal("rentArea"));
}
}
if (total.compareTo(new BigDecimal(0)) <= 0 ) {
total = new BigDecimal(1);
}
Map<Long,BigDecimal> shopAreaRateMap = new HashMap<Long,BigDecimal>();
for (Iterator<Long> it = shopAreaMap.keySet().iterator();it.hasNext();) {
Long sid = it.next();
BigDecimal sa = shopAreaMap.get(sid);
shopAreaRateMap.put(sid, sa.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP));
}
return shopAreaRateMap;
return shopAreaMap;
}
return null;
}


+ 37
- 10
mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java Просмотреть файл

@@ -20,6 +20,7 @@ import com.iformall.domain.po.WxRentContractAgileDepositShop;
import com.iformall.domain.po.WxRentContractAgileUnDeposit;
import com.iformall.domain.po.WxRentContractAgileUnDepositItem;
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.enums.EnumBillAllType;
@@ -392,7 +393,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
Map<Long,WxEnergyFees> typeMap = wxEnergyService.getFeesMap(fq);
//根据关联的店铺面积来分金额
Map<Long, BigDecimal> shopAreaRateMap = wxRentContract.getRentShopAreaRate();
Map<Long, BigDecimal> shopAreaRateMap = wxRentContract.getRentShopArea();
if (null == shopAreaRateMap) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息");
}
@@ -406,7 +407,9 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
WxEnergyFees fees = typeMap.get(deposit.getFeesId());
for (int j = 0 ; j < shopIdList.size(); j++ ) {
Long sid = shopIdList.get(j);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxAllBill wxBillDeposit = new WxAllBill();
wxBillDeposit.setId(idWorker.nextId());
wxBillDeposit.updateTenantInfo(wxRentContract);
@@ -468,7 +471,6 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
EnumRentDayPriceCalcute dayPriceCalcute = EnumRentDayPriceCalcute.getEnum(contract.getDayPriceCalcute());
List<Date> yearsBeginList = WxRentContractAgileHelper.getYearsBeginList(contract.getRentalStartDate(), contract.getRentalEndDate());
List
List<WxAllBill> insertList = new ArrayList<WxAllBill>();
final IdWorker idWorker = IdWorker.get();
@@ -508,12 +510,37 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
}
}
private WxAllBill generateUnDepositBill(final IdWorker idWorker,WxRentContractAgileUnDeposit unDeposit,WxEnergyFees fees,
Date start,Date end,Date receiveDate,String needpay,WxRentContractAgileUnDepositItem item,MallUserInfo user) {
private List<WxAllBill> generateUnDepositBill(List<Long> shopIdList,Map<Long, BigDecimal> shopAreaRateMap,Map<Long, WxShopUsers> shopUserMap,final IdWorker idWorker,WxRentContractAgileUnDeposit unDeposit,
WxEnergyFees fees,Date start,Date end,Date receiveDate,String needpay,WxRentContractAgileUnDepositItem item,MallUserInfo user) {
//如果是按合同,则按照铺来分
if (unDeposit.getSettingMethod() == EnumRentContractAgilSettingMethod.BY_CONTRACT.getCode()) {
for (int i = 0 ; i < shopIdList.size(); i++) {
Long sid= shopIdList.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
String cusName = "";
buildUnDepositBill(unDeposit,idWorker,unDeposit.getRentContractId(),fees,sid,cusName,start,end,receiveDate,needpay,item.getRentArea(),user);
}
}else {
for (int i = 0 ; i < shopIdList.size(); i++) {
Long sid= shopIdList.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
String cusName = "";
buildUnDepositBill(unDeposit,idWorker,unDeposit.getRentContractId(),fees,item.getShopId(),cusName,start,end,receiveDate,needpay,item.getRentArea(),user);
}
}
return wxBillRent;
}
private WxAllBill buildUnDepositBill(TenantEntity tenantEntity,final IdWorker idWorker,Long rentContractId,WxEnergyFees fees,
Long shopId,String cusName,Date start,Date end,Date receiveDate,String needpay,String rentArea,MallUserInfo user) {
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setIsPreview(EnumYesOrNo.YES.getCode());
wxBillRent.setId(idWorker.nextId());
wxBillRent.setRentContractId(unDeposit.getRentContractId());
wxBillRent.setRentContractId(rentContractId);
wxBillRent.setRentContractAgileFeesType(EnumRentContractAgileFeesType.UN_DEPOSIT.getCode());
wxBillRent.setEnergyFeesId(fees.getId());
wxBillRent.setBillType(fees.getBillType());
@@ -527,10 +554,10 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
wxBillRent.setReceivePay(needpay);
//截止收租日在当前时间之前
Date date = new Date();
wxBillRent.updateTenantInfo(unDeposit);
wxBillRent.setShopId(item.getShopId());
wxBillRent.setCusName(shopNumber);
wxBillRent.setRentArea(item.getRentArea());
wxBillRent.updateTenantInfo(tenantEntity);
wxBillRent.setShopId(shopId);
wxBillRent.setCusName(cusName);
wxBillRent.setRentArea(rentArea);
wxBillRent.setCreatetime(date);
wxBillRent.setCreateBy(user.getId());
wxBillRent.setCreateByName(user.getName());


+ 25
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -595,7 +595,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
final IdWorker idWorker = IdWorker.get();
List<Long> shopIds = record.shopIdsByRentInfo();
//根据关联的店铺面积来分金额
Map<Long, BigDecimal> shopAreaRateMap = record.getRentShopAreaRate();
Map<Long, BigDecimal> shopAreaRateMap = record.getRentShopArea();
if (null == shopAreaRateMap) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息");
}
@@ -640,7 +640,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int i = 0 ; i < shopIds.size(); i ++) {
WxAllBill b = new WxAllBill();
Long sid = shopIds.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(record.getRentArea()),record.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
try {
BeanUtils.copyProperties(b, bill);
b.setId(idWorker.nextId());
@@ -686,7 +688,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int count = 1;
List<Long> shopIds = record.shopIdsByRentInfo();
//根据关联的店铺面积来分金额
Map<Long, BigDecimal> shopAreaRateMap = record.getRentShopAreaRate();
Map<Long, BigDecimal> shopAreaRateMap = record.getRentShopArea();
if (null == shopAreaRateMap) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息");
}
@@ -710,7 +712,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
for (int i = 0 ; i < shopIds.size(); i ++) {
Long sid = shopIds.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(record.getRentArea()),record.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxAllBill bill = new WxAllBill();
bill.setId(idWorker.nextId());
Date date = new Date();
@@ -903,7 +907,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//根据不同的科目生成不同的押金账单
Map<Long,WxEnergyFees> feesMap = wxRentContract.getDepositEnergyFees(typeMap);
Map<Long, BigDecimal> shopAreaRateMap = wxRentContract.getRentShopAreaRate();
Map<Long, BigDecimal> shopAreaRateMap = wxRentContract.getRentShopArea();
if (null == shopAreaRateMap) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息");
}
@@ -917,7 +921,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int i = 0 ; i < shopIdList.size(); i++ ) {
Long sid = shopIdList.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxAllBill wxBillDeposit = new WxAllBill();
wxBillDeposit.setId(idWorker.nextId());
wxBillDeposit.setRentContractId(wxRentContract.getId());
@@ -1238,7 +1244,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
List<Long> shopIdList = wxRentContract.shopIdsByRentInfo();
Map<Long, BigDecimal> shopAreaRateMap = wxRentContract.getRentShopAreaRate();
Map<Long, BigDecimal> shopAreaRateMap = wxRentContract.getRentShopArea();
if (null == shopAreaRateMap) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息");
}
@@ -1453,7 +1459,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int g = 0 ; g < shopIdList.size(); g ++ ){
WxAllBill rs = new WxAllBill();
Long sid = shopIdList.get(g);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
try {
BeanUtils.copyProperties(rs, rb);
rs.setId(idWorker.nextId());
@@ -1485,7 +1492,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int g = 0 ; g < shopIdList.size(); g ++ ){
WxAllBill rs = new WxAllBill();
Long sid = shopIdList.get(g);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
try {
BeanUtils.copyProperties(rs, rb);
rs.setId(idWorker.nextId());
@@ -2756,7 +2764,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
List<Long> shopIdList = rentcontract.shopIdsByRentInfo();
Map<Long, BigDecimal> shopAreaRateMap = rentcontract.getRentShopAreaRate();
Map<Long, BigDecimal> shopAreaRateMap = rentcontract.getRentShopArea();
WxShopUsers suq = new WxShopUsers();
suq.updateTenantInfo(rentcontract);
suq.setShopIds(shopIdList);
@@ -2813,7 +2821,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < shopIds.size(); i++) {
Long sid = shopIds.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
String newmoney = new BigDecimal(bussinessmoney).multiply(shoprate).setScale(rentcontract.getDecimalSize()).toPlainString();
WxAllBill b = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
@@ -2862,7 +2872,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < shopIds.size() ; i ++) {
Long sid = shopIds.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxAllBill bmbill = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
@@ -2902,7 +2913,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < shopIds.size(); i++) {
Long sid = shopIds.get(i);
BigDecimal shoprate = shopAreaRateMap.get(sid);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(rentcontract.getRentArea()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxAllBill bmbill = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
bmbill.setId(idWorker.nextId());


Загрузка…
Отмена
Сохранить