|
|
|
@@ -923,72 +923,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void buildBussinessManagementFee( Long userId,WxRentContract wxRentContract) { |
|
|
|
if (wxRentContract != null && wxRentContract.getBussinessManagementFee() > 0) { |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
WxBillDeposit wxBillDeposit = new WxBillDeposit(); |
|
|
|
wxBillDeposit.setId(idWorker.nextId()); |
|
|
|
wxBillDeposit.setRentContractId(wxRentContract.getId()); |
|
|
|
wxBillDeposit.setPay(0L); |
|
|
|
long needpay = wxRentContract.getDeposit(); |
|
|
|
wxBillDeposit.setReceivePay(needpay); |
|
|
|
wxBillDeposit.setNeedPay(needpay); |
|
|
|
wxBillDeposit.setOwe(needpay); |
|
|
|
//找到计租方式 |
|
|
|
int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; |
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
instance.setTime(wxRentContract.getRentalStartDate()); |
|
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
Date time = instance.getTime(); |
|
|
|
wxBillDeposit.setReceiveDate(time); |
|
|
|
|
|
|
|
//账单开始时间 |
|
|
|
instance.clear(); |
|
|
|
instance.setTime(wxBillDeposit.getReceiveDate()); |
|
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
|
wxBillDeposit.setStarttime(instance.getTime()); |
|
|
|
//账单结束时间 |
|
|
|
instance.clear(); |
|
|
|
instance.setTime(wxBillDeposit.getReceiveDate()); |
|
|
|
instance.add(dayType, wxRentContract.getLease()); |
|
|
|
wxBillDeposit.setEndtime(instance.getTime()); |
|
|
|
wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
wxBillDeposit.setExpiredDay(0L); |
|
|
|
wxBillDeposit.setReceiveDate(time); |
|
|
|
wxBillDeposit.updateTenantInfo(wxRentContract); |
|
|
|
wxBillDeposit.setIsDel(0); |
|
|
|
wxBillDeposit.setMerchantId(wxRentContract.getMerchantId()); |
|
|
|
wxBillDeposit.setUserId(userId); |
|
|
|
if (wxRentContract.shopIdsByRentInfo().size()==1) { |
|
|
|
wxBillDeposit.setShopId(wxRentContract.shopIdsByRentInfo().get(0)); |
|
|
|
} |
|
|
|
wxBillDeposit.setCreatetime(date); |
|
|
|
wxBillDeposit.setUpdatetime(date); |
|
|
|
wxBillDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
wxBillDeposit.setRentShopType(wxRentContract.getRentShopType()); |
|
|
|
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { |
|
|
|
String rentInfo = wxRentContract.getRentInfo(); |
|
|
|
if (rentInfo != null) { |
|
|
|
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); |
|
|
|
Map<String, Object> shopInfo = new HashMap<>(); |
|
|
|
for (int i = 0, size = rentInfoArray.size(); i < size; i++) { |
|
|
|
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); |
|
|
|
shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("deposit")); |
|
|
|
} |
|
|
|
wxBillDeposit.setShopInfo(JSONObject.toJSONString(shopInfo)); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
wxBillDepositMapper.insert(wxBillDeposit); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("添加押金账单失败,e:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object getMerchants(WxRentContract wxRentContract) { |
|
|
|
List<WxRentContract> rentContractList = wxRentContractMapper.getMerchants(wxRentContract); |
|
|
|
|