|
|
|
@@ -182,40 +182,40 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
public void updateBill(Map<String, Object> bill) { |
|
|
|
int billTypeValue = ((Long) bill.get("billTypeValue")).intValue(); |
|
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>账单回调修改数据:" + JSONObject.toJSONString(bill)); |
|
|
|
if (billTypeValue==EnumBillTypeParam.RENT.getCode().intValue()) { |
|
|
|
if (billTypeValue == EnumBillTypeParam.RENT.getCode().intValue()) { |
|
|
|
logger.info("更新租金账单"); |
|
|
|
WxBillRent billRent = wxBillRentMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(billRent!=null && !billRent.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (billRent != null && !billRent.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillRent(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue==EnumBillTypeParam.RENT_DEPOSIT.getCode().intValue()) { |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.RENT_DEPOSIT.getCode().intValue()) { |
|
|
|
logger.info("更新租金押金账单"); |
|
|
|
WxBillDeposit billDeposit = wxBillDepositMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(billDeposit!=null && !billDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (billDeposit != null && !billDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillRentDeposit(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue==EnumBillTypeParam.PROPERTY.getCode().intValue()) { |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.PROPERTY.getCode().intValue()) { |
|
|
|
logger.info("更新物业账单"); |
|
|
|
WxBillProperty property = wxBillPropertyMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(property!=null && !property.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (property != null && !property.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillProperty(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue==EnumBillTypeParam.PROPERTY_DEPOSIT.getCode().intValue()) { |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.PROPERTY_DEPOSIT.getCode().intValue()) { |
|
|
|
logger.info("更新物业押金账单"); |
|
|
|
WxBillPropertyDeposit wxBillPropertyDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(wxBillPropertyDeposit!=null && !wxBillPropertyDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (wxBillPropertyDeposit != null && !wxBillPropertyDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillPropertyDeposit(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue==EnumBillTypeParam.WATER.getCode().intValue()) { |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.WATER.getCode().intValue()) { |
|
|
|
logger.info("更新水费账单"); |
|
|
|
WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(wxBillDaily!=null && !wxBillDaily.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillDaily(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue==EnumBillTypeParam.POWER.getCode().intValue()) { |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.POWER.getCode().intValue()) { |
|
|
|
logger.info("更新电费账单"); |
|
|
|
WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(wxBillDaily!=null && !wxBillDaily.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillDaily(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.AIR_CONDITIONING.getCode().intValue()) { |
|
|
|
@@ -224,10 +224,10 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillDaily(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue==EnumBillTypeParam.ROUTINE.getCode().intValue()) { |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.ROUTINE.getCode().intValue()) { |
|
|
|
logger.info("更新其他账单"); |
|
|
|
WxBillOther wxBillOther = wxBillOtherMapper.selectByPrimaryKey(bill.get("id")); |
|
|
|
if(wxBillOther!=null && !wxBillOther.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ |
|
|
|
if (wxBillOther != null && !wxBillOther.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
updateBillOther(bill); |
|
|
|
} |
|
|
|
} else if (billTypeValue == EnumBillTypeParam.ATHER_DEPOSIT.getCode().intValue()) { |
|
|
|
@@ -313,16 +313,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
private int updateBillOther(Map<String, Object> bill) { |
|
|
|
logger.info("updateBillOther params:"+bill.toString()); |
|
|
|
logger.info("updateBillOther params:" + bill.toString()); |
|
|
|
Object id = bill.get("id"); |
|
|
|
WxBillOther wxBillOther = wxBillOtherMapper.selectByPrimaryKey(id); |
|
|
|
if(wxBillOther==null){ |
|
|
|
if (wxBillOther == null) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
wxBillOther.setPayDate(date); |
|
|
|
Long owe = (Long) bill.get("owe"); |
|
|
|
wxBillOther.setPay(wxBillOther.getPay()+owe); |
|
|
|
wxBillOther.setPay(wxBillOther.getPay() + owe); |
|
|
|
wxBillOther.setOwe(0L); |
|
|
|
wxBillOther.setStatus(EnumBillDailyStatus.PAID.getCode()); |
|
|
|
wxBillOther.setPayDate(date); |
|
|
|
@@ -357,16 +357,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
private int updateBillDaily(Map<String, Object> bill) { |
|
|
|
logger.info("updateBillDaily params:"+bill.toString()); |
|
|
|
logger.info("updateBillDaily params:" + bill.toString()); |
|
|
|
Object id = bill.get("id"); |
|
|
|
WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(id); |
|
|
|
if(wxBillDaily==null){ |
|
|
|
if (wxBillDaily == null) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
wxBillDaily.setPayDate(date); |
|
|
|
Long owe = (Long) bill.get("owe"); |
|
|
|
wxBillDaily.setPay(wxBillDaily.getPay()+owe); |
|
|
|
wxBillDaily.setPay(wxBillDaily.getPay() + owe); |
|
|
|
wxBillDaily.setOwe(0L); |
|
|
|
wxBillDaily.setStatus(EnumBillDailyStatus.PAID.getCode()); |
|
|
|
wxBillDaily.setPayDate(date); |
|
|
|
@@ -402,16 +402,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
private int updateBillPropertyDeposit(Map<String, Object> bill) { |
|
|
|
logger.info("updateBillPropertyDeposit params:"+bill.toString()); |
|
|
|
logger.info("updateBillPropertyDeposit params:" + bill.toString()); |
|
|
|
Object id = bill.get("id"); |
|
|
|
WxBillPropertyDeposit wxBillPropertyDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(id); |
|
|
|
if(wxBillPropertyDeposit==null){ |
|
|
|
if (wxBillPropertyDeposit == null) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
wxBillPropertyDeposit.setPayDate(date); |
|
|
|
Long owe = (Long) bill.get("owe"); |
|
|
|
wxBillPropertyDeposit.setPay(wxBillPropertyDeposit.getPay()+owe); |
|
|
|
wxBillPropertyDeposit.setPay(wxBillPropertyDeposit.getPay() + owe); |
|
|
|
wxBillPropertyDeposit.setOwe(0L); |
|
|
|
wxBillPropertyDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); |
|
|
|
wxBillPropertyDeposit.setPayDate(date); |
|
|
|
@@ -447,16 +447,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
private int updateBillProperty(Map<String, Object> bill) { |
|
|
|
logger.info("updateBillProperty params:"+bill.toString()); |
|
|
|
logger.info("updateBillProperty params:" + bill.toString()); |
|
|
|
Object id = bill.get("id"); |
|
|
|
WxBillProperty property = wxBillPropertyMapper.selectByPrimaryKey(id); |
|
|
|
if(property==null){ |
|
|
|
if (property == null) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
property.setPayDate(date); |
|
|
|
Long owe = (Long) bill.get("owe"); |
|
|
|
property.setPay(property.getPay()+owe); |
|
|
|
property.setPay(property.getPay() + owe); |
|
|
|
property.setOwe(0L); |
|
|
|
property.setStatus(EnumBillDailyStatus.PAID.getCode()); |
|
|
|
property.setPayDate(date); |
|
|
|
@@ -492,16 +492,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
private int updateBillRentDeposit(Map<String, Object> bill) { |
|
|
|
logger.info("updateBillRentDeposit params:"+bill.toString()); |
|
|
|
logger.info("updateBillRentDeposit params:" + bill.toString()); |
|
|
|
Object id = bill.get("id"); |
|
|
|
WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectByPrimaryKey(id); |
|
|
|
if(wxBillDeposit==null){ |
|
|
|
if (wxBillDeposit == null) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
wxBillDeposit.setPayDate(date); |
|
|
|
Long owe = (Long) bill.get("owe"); |
|
|
|
wxBillDeposit.setPay(wxBillDeposit.getPay()+owe); |
|
|
|
wxBillDeposit.setPay(wxBillDeposit.getPay() + owe); |
|
|
|
wxBillDeposit.setOwe(0L); |
|
|
|
wxBillDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); |
|
|
|
wxBillDeposit.setPayDate(date); |
|
|
|
@@ -537,16 +537,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
private int updateBillRent(Map<String, Object> bill) { |
|
|
|
logger.info("updateBillRentDeposit params:"+bill.toString()); |
|
|
|
logger.info("updateBillRentDeposit params:" + bill.toString()); |
|
|
|
Object id = bill.get("id"); |
|
|
|
WxBillRent wxBillRent = wxBillRentMapper.selectByPrimaryKey(id); |
|
|
|
if(wxBillRent==null){ |
|
|
|
if (wxBillRent == null) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
wxBillRent.setPayDate(date); |
|
|
|
Long owe = (Long) bill.get("owe"); |
|
|
|
wxBillRent.setPay(wxBillRent.getPay()+owe); |
|
|
|
wxBillRent.setPay(wxBillRent.getPay() + owe); |
|
|
|
wxBillRent.setOwe(0L); |
|
|
|
wxBillRent.setStatus(EnumBillDailyStatus.PAID.getCode()); |
|
|
|
wxBillRent.setPayDate(date); |
|
|
|
@@ -781,11 +781,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
WxBillRent wxBillRent = new WxBillRent(); |
|
|
|
wxBillRent.setId(id); |
|
|
|
wxBillRent.setUpdatetime(updateDate); |
|
|
|
if(oldLatePrice != null){ |
|
|
|
if (oldLatePrice != null) { |
|
|
|
wxBillRent.setLatePayPrice(newLatePrice); |
|
|
|
wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); |
|
|
|
addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY,id, oldLatePrice, newLatePrice, user); |
|
|
|
}else{ |
|
|
|
addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); |
|
|
|
} else { |
|
|
|
//租赁账单更新 |
|
|
|
wxBillRent.setReceivePay(newPrice); |
|
|
|
wxBillRent.setOwe(newPrice - dbBill.getPay()); |
|
|
|
@@ -794,7 +794,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} |
|
|
|
} else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { |
|
|
|
WxBillDeposit dbBill = wxBillDepositMapper.selectByPrimaryKey(id); |
|
|
|
@@ -809,18 +809,18 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
wxBillDeposit.setUpdatetime(updateDate); |
|
|
|
wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { |
|
|
|
WxBillProperty dbBill = wxBillPropertyMapper.selectByPrimaryKey(id); |
|
|
|
//物业账单更新 |
|
|
|
WxBillProperty wxBillProperty = new WxBillProperty(); |
|
|
|
wxBillProperty.setId(id); |
|
|
|
wxBillProperty.setUpdatetime(updateDate); |
|
|
|
if(oldLatePrice != null){ |
|
|
|
if (oldLatePrice != null) { |
|
|
|
wxBillProperty.setLatePayPrice(newLatePrice); |
|
|
|
wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillProperty); |
|
|
|
addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY,id, oldLatePrice, newLatePrice, user); |
|
|
|
}else{ |
|
|
|
addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); |
|
|
|
} else { |
|
|
|
wxBillProperty.setReceivePay(newPrice); |
|
|
|
wxBillProperty.setOwe(newPrice - dbBill.getPay()); |
|
|
|
if (newPrice.equals(dbBill.getPay())) { |
|
|
|
@@ -828,7 +828,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillProperty); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} |
|
|
|
} else if (billType.equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { |
|
|
|
WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(id); |
|
|
|
@@ -843,22 +843,22 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
wxBillPropertyDeposit.setUpdatetime(updateDate); |
|
|
|
wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillPropertyDeposit); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.WATER.getCode())) { |
|
|
|
//水费账单更新 |
|
|
|
updateDailyBill(id, newPrice, updateDate); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.POWER.getCode())) { |
|
|
|
//电费账单更新 |
|
|
|
updateDailyBill(id, newPrice, updateDate); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) { |
|
|
|
//空调费账单更新 |
|
|
|
updateDailyBill(id, newPrice, updateDate); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.ROUTINE.getCode())) { |
|
|
|
WxBillOther dbBill = wxBillOtherMapper.selectByPrimaryKey(id); |
|
|
|
//其他费用账单更新 |
|
|
|
@@ -872,7 +872,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
wxBillOther.setUpdatetime(updateDate); |
|
|
|
wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) { |
|
|
|
WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(id); |
|
|
|
//其他押金账单更新 |
|
|
|
@@ -886,7 +886,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
wxBillOtherDeposit.setUpdatetime(updateDate); |
|
|
|
wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); |
|
|
|
//账单日志 |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL,id, oldPrice, newPrice, user); |
|
|
|
addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); |
|
|
|
} else { |
|
|
|
logger.info("未找到账单类型"); |
|
|
|
} |
|
|
|
@@ -894,7 +894,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void addBillAction(EnumBillAction billAction,Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo) { |
|
|
|
public void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo) { |
|
|
|
WxBillAction wxBillAction = new WxBillAction(); |
|
|
|
wxBillAction.setBillId(billId); |
|
|
|
String oldPriceStr = new BigDecimal(oldPrice).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
@@ -1035,7 +1035,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
dailyQuery.setReceiveDate(bill.getReceiveDate()); |
|
|
|
dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
WxBillDaily daily = wxBillDailyMapper.selectOne(dailyQuery); |
|
|
|
if (daily != null) { |
|
|
|
if (daily != null && pay > 0) { |
|
|
|
if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); |
|
|
|
@@ -1083,7 +1083,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
daily.setStatus(expiredDayAndStatus.getStatus()); |
|
|
|
wxBillDailyMapper.insertSelective(daily); |
|
|
|
addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
if (pay > 0) { |
|
|
|
addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { |
|
|
|
@@ -1094,7 +1096,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
otherQuery.setName(bill.getBillAttr()); |
|
|
|
otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
WxBillOther other = wxBillOtherMapper.selectOne(otherQuery); |
|
|
|
if (other != null) { |
|
|
|
if (other != null && pay > 0) { |
|
|
|
if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
|
long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); |
|
|
|
@@ -1145,7 +1147,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
other.setStatus(expiredDayAndStatus.getStatus()); |
|
|
|
wxBillOtherMapper.insertSelective(other); |
|
|
|
addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
if (pay > 0) { |
|
|
|
addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (billType.equals(EnumBillExcelTemplate.OTHER_DEPOSIT.getCode())) { |
|
|
|
@@ -1156,7 +1160,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
otherDepositQuery.setComments(bill.getBillAttr()); |
|
|
|
otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
WxBillOtherDeposit otherDeposit = wxBillOtherDepositMapper.selectOne(otherDepositQuery); |
|
|
|
if (otherDeposit != null) { |
|
|
|
if (otherDeposit != null && pay > 0) { |
|
|
|
if (!otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode()) && !otherDeposit.getStatus().equals(EnumBillRentStatus.RETURN.getCode())) { |
|
|
|
long allPay = new BigDecimal(otherDeposit.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
|
otherDeposit.setExpiredDay(0L); |
|
|
|
@@ -1212,7 +1216,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
} |
|
|
|
wxBillOtherDepositMapper.insertSelective(otherDeposit); |
|
|
|
addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
if (pay > 0) { |
|
|
|
addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
@@ -1284,7 +1290,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
rent.setPayDate(bill.getPayDate()); |
|
|
|
rent.setReceiveDate(bill.getReceiveDate()); |
|
|
|
wxBillRentMapper.updateByPrimaryKey(rent); |
|
|
|
addActionImport(rent.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
if (pay > 0) { |
|
|
|
addActionImport(rent.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_PROPERTY.getCode())) { |
|
|
|
WxBillProperty propertyQuery = new WxBillProperty(); |
|
|
|
@@ -1309,7 +1317,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
property.setPayDate(bill.getPayDate()); |
|
|
|
property.setReceiveDate(bill.getReceiveDate()); |
|
|
|
wxBillPropertyMapper.updateByPrimaryKey(property); |
|
|
|
addActionImport(property.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
if (pay > 0) { |
|
|
|
addActionImport(property.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
logger.error("账单导入失败"); |
|
|
|
@@ -1367,24 +1377,24 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Long hasOweBill(Long contractId, Integer type) { |
|
|
|
if(type.intValue() == 1){ |
|
|
|
return wxBillRentMapper.oweBillCount(contractId); |
|
|
|
}else if(type.intValue() == 2){ |
|
|
|
return wxBillPropertyMapper.oweBillCount(contractId); |
|
|
|
if (type.intValue() == 1) { |
|
|
|
return wxBillRentMapper.oweBillCount(contractId); |
|
|
|
} else if (type.intValue() == 2) { |
|
|
|
return wxBillPropertyMapper.oweBillCount(contractId); |
|
|
|
} |
|
|
|
return 0L; |
|
|
|
} |
|
|
|
|
|
|
|
public Map<Long, List<Map<String, Object>>> toMap(List<Map<String, Object>> mapList){ |
|
|
|
public Map<Long, List<Map<String, Object>>> toMap(List<Map<String, Object>> mapList) { |
|
|
|
Map<Long, List<Map<String, Object>>> result = new HashMap<>(); |
|
|
|
for (Map<String, Object> bill:mapList) { |
|
|
|
Long merchantId = (Long)bill.get("merchantId"); |
|
|
|
for (Map<String, Object> bill : mapList) { |
|
|
|
Long merchantId = (Long) bill.get("merchantId"); |
|
|
|
List<Map<String, Object>> currList = result.get(merchantId); |
|
|
|
if (currList == null) { |
|
|
|
currList = new ArrayList<>(); |
|
|
|
} |
|
|
|
currList.add(bill); |
|
|
|
result.put(merchantId,currList); |
|
|
|
result.put(merchantId, currList); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
@@ -1393,19 +1403,19 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
public void sendWaitPayBillEmail() { |
|
|
|
List<Map<String, Object>> waitBillListForEmail = wxBillAllMapper.getWaitPayBillForEmail(); |
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(waitBillListForEmail)) { |
|
|
|
if (CollectionUtils.isNotEmpty(waitBillListForEmail)) { |
|
|
|
Map<Long, List<Map<String, Object>>> merchantMap = toMap(waitBillListForEmail); |
|
|
|
for (Long merchantId : merchantMap.keySet()) { |
|
|
|
List<Map<String, Object>> mapList = merchantMap.get(merchantId); |
|
|
|
if(CollectionUtils.isNotEmpty(mapList)){ |
|
|
|
String email = (String)mapList.get(0).get("email"); |
|
|
|
if(StringUtils.isBlank(email)){ |
|
|
|
if (CollectionUtils.isNotEmpty(mapList)) { |
|
|
|
String email = (String) mapList.get(0).get("email"); |
|
|
|
if (StringUtils.isBlank(email)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
String tenantId = (String)mapList.get(0).get("tenantId"); |
|
|
|
String receiveDate = (String)mapList.get(0).get("receiveDate"); |
|
|
|
String manager = (String)mapList.get(0).get("manager"); |
|
|
|
String managerPhone = (String)mapList.get(0).get("managerPhone"); |
|
|
|
String tenantId = (String) mapList.get(0).get("tenantId"); |
|
|
|
String receiveDate = (String) mapList.get(0).get("receiveDate"); |
|
|
|
String manager = (String) mapList.get(0).get("manager"); |
|
|
|
String managerPhone = (String) mapList.get(0).get("managerPhone"); |
|
|
|
|
|
|
|
String billListStr = ""; |
|
|
|
BigDecimal sumNeedPay = new BigDecimal(0); |
|
|
|
@@ -1426,8 +1436,8 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
map.put("price", sumNeedPay.toString()); |
|
|
|
map.put("date", receiveDate); |
|
|
|
map.put("billList", billListStr); |
|
|
|
map.put("linkName",manager==null?"":manager); |
|
|
|
map.put("linkPhone",managerPhone==null?"":managerPhone); |
|
|
|
map.put("linkName", manager == null ? "" : manager); |
|
|
|
map.put("linkPhone", managerPhone == null ? "" : managerPhone); |
|
|
|
MailMsg mailMsg = new MailMsg(); |
|
|
|
mailMsg.setSubject("待缴账单通知"); |
|
|
|
mailMsg.setHtml(true); |
|
|
|
@@ -1447,20 +1457,20 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
public void sendOweBillForEmail() { |
|
|
|
List<Map<String, Object>> oweBillForEmail = wxBillAllMapper.getOweBillForEmail(); |
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(oweBillForEmail)) { |
|
|
|
if (CollectionUtils.isNotEmpty(oweBillForEmail)) { |
|
|
|
Map<Long, List<Map<String, Object>>> merchantMap = toMap(oweBillForEmail); |
|
|
|
for (Long merchantId : merchantMap.keySet()) { |
|
|
|
List<Map<String, Object>> mapList = merchantMap.get(merchantId); |
|
|
|
if(CollectionUtils.isNotEmpty(mapList)){ |
|
|
|
String email = (String)mapList.get(0).get("email"); |
|
|
|
if(StringUtils.isBlank(email)){ |
|
|
|
if (CollectionUtils.isNotEmpty(mapList)) { |
|
|
|
String email = (String) mapList.get(0).get("email"); |
|
|
|
if (StringUtils.isBlank(email)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
String tenantId = (String)mapList.get(0).get("tenantId"); |
|
|
|
String receiveDate = (String)mapList.get(0).get("receiveDate"); |
|
|
|
String manager = (String)mapList.get(0).get("manager"); |
|
|
|
String managerPhone = (String)mapList.get(0).get("managerPhone"); |
|
|
|
Long expiredDay = (Long)mapList.get(0).get("expiredDay"); |
|
|
|
String tenantId = (String) mapList.get(0).get("tenantId"); |
|
|
|
String receiveDate = (String) mapList.get(0).get("receiveDate"); |
|
|
|
String manager = (String) mapList.get(0).get("manager"); |
|
|
|
String managerPhone = (String) mapList.get(0).get("managerPhone"); |
|
|
|
Long expiredDay = (Long) mapList.get(0).get("expiredDay"); |
|
|
|
|
|
|
|
String billListStr = ""; |
|
|
|
BigDecimal sumNeedPay = new BigDecimal(0); |
|
|
|
@@ -1483,8 +1493,8 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
map.put("price", sumNeedPay.toString()); |
|
|
|
map.put("date", receiveDate); |
|
|
|
map.put("billList", billListStr); |
|
|
|
map.put("linkName",manager==null?"":manager); |
|
|
|
map.put("linkPhone",managerPhone==null?"":managerPhone); |
|
|
|
map.put("linkName", manager == null ? "" : manager); |
|
|
|
map.put("linkPhone", managerPhone == null ? "" : managerPhone); |
|
|
|
MailMsg mailMsg = new MailMsg(); |
|
|
|
mailMsg.setSubject("欠缴账单通知"); |
|
|
|
mailMsg.setHtml(true); |
|
|
|
@@ -1505,12 +1515,12 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
public Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { |
|
|
|
PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); |
|
|
|
List<Map<String, Object>> list = pageInfo.getList(); |
|
|
|
for (Map<String, Object> map:list) { |
|
|
|
map.put("rentOwe",subZeroAndDot(map.get("rentOwe").toString())); |
|
|
|
map.put("propertyOwe",subZeroAndDot(map.get("propertyOwe").toString())); |
|
|
|
map.put("depositOwe",subZeroAndDot(map.get("depositOwe").toString())); |
|
|
|
map.put("otherOwe",subZeroAndDot(map.get("otherOwe").toString())); |
|
|
|
map.put("totalOwe",subZeroAndDot(map.get("totalOwe").toString())); |
|
|
|
for (Map<String, Object> map : list) { |
|
|
|
map.put("rentOwe", subZeroAndDot(map.get("rentOwe").toString())); |
|
|
|
map.put("propertyOwe", subZeroAndDot(map.get("propertyOwe").toString())); |
|
|
|
map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); |
|
|
|
map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); |
|
|
|
map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); |
|
|
|
} |
|
|
|
pageInfo.setList(list); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
@@ -1520,11 +1530,12 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 使用java正则表达式去掉多余的.与0 |
|
|
|
* |
|
|
|
* @param s |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public static String subZeroAndDot(String s){ |
|
|
|
if(s.indexOf(".") > 0){ |
|
|
|
public static String subZeroAndDot(String s) { |
|
|
|
if (s.indexOf(".") > 0) { |
|
|
|
s = s.replaceAll("0+?$", "");//去掉多余的0 |
|
|
|
s = s.replaceAll("[.]$", "");//如最后一位是.则去掉 |
|
|
|
} |
|
|
|
@@ -1535,11 +1546,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
public void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
List<Map<String, Object>> data = wxBillAllMapper.getOweBillAsPage(record); |
|
|
|
List<OweMerchantVo> list = new ArrayList<>(); |
|
|
|
for (Map<String, Object> map:data) { |
|
|
|
for (Map<String, Object> map : data) { |
|
|
|
OweMerchantVo oweMerchantVo = new OweMerchantVo(); |
|
|
|
oweMerchantVo.setLinkPerson((String)map.get("manager")); |
|
|
|
oweMerchantVo.setName((String)map.get("merchantName")); |
|
|
|
oweMerchantVo.setLinkPhone((String)map.get("managerPhone")); |
|
|
|
oweMerchantVo.setLinkPerson((String) map.get("manager")); |
|
|
|
oweMerchantVo.setName((String) map.get("merchantName")); |
|
|
|
oweMerchantVo.setLinkPhone((String) map.get("managerPhone")); |
|
|
|
|
|
|
|
oweMerchantVo.setDepositOwe(new BigDecimal(subZeroAndDot(map.get("depositOwe").toString()))); |
|
|
|
oweMerchantVo.setOtherOwe(new BigDecimal(subZeroAndDot(map.get("otherOwe").toString()))); |
|
|
|
@@ -1556,11 +1567,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
public void exportWaitMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
List<Map<String, Object>> data = wxBillAllMapper.getOweBillAsPage(record); |
|
|
|
List<WaitMerchantVo> list = new ArrayList<>(); |
|
|
|
for (Map<String, Object> map:data) { |
|
|
|
for (Map<String, Object> map : data) { |
|
|
|
WaitMerchantVo oweMerchantVo = new WaitMerchantVo(); |
|
|
|
oweMerchantVo.setLinkPerson((String)map.get("manager")); |
|
|
|
oweMerchantVo.setName((String)map.get("merchantName")); |
|
|
|
oweMerchantVo.setLinkPhone((String)map.get("managerPhone")); |
|
|
|
oweMerchantVo.setLinkPerson((String) map.get("manager")); |
|
|
|
oweMerchantVo.setName((String) map.get("merchantName")); |
|
|
|
oweMerchantVo.setLinkPhone((String) map.get("managerPhone")); |
|
|
|
|
|
|
|
oweMerchantVo.setRentReceivePay(new BigDecimal(subZeroAndDot(map.get("rentReceivePay").toString()))); |
|
|
|
oweMerchantVo.setPropertyReceivePay(new BigDecimal(subZeroAndDot(map.get("propertyReceivePay").toString()))); |
|
|
|
|