| @@ -273,7 +273,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| @SystemControllerLog(description = "物业合同-终止合同") | |||
| public ResultData endContract(@RequestBody WxPropertyContract proertyContract) { | |||
| proertyContract.updateTenantInfo(getTenantInfo()); | |||
| wxPropertyContractService.endContract(proertyContract); | |||
| wxPropertyContractService.endContract(proertyContract,this.getUser()); | |||
| return new ResultData(proertyContract); | |||
| } | |||
| @@ -479,13 +479,13 @@ public class WxRentContractController extends WxContractBaseController { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| wxRentContract.updateTenantInfo(contract); | |||
| wxRentContractService.endContract(wxRentContract); | |||
| wxRentContractService.endContract(wxRentContract,this.getUser()); | |||
| //租金+物业的终止 | |||
| if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | |||
| WxPropertyContract wpc = new WxPropertyContract(); | |||
| wpc.setId(wxRentContract.getPropertyId()); | |||
| wpc.setEndContractTime(wxRentContract.getEndContractTime()); | |||
| wxPropertyContractService.endContract(wpc); | |||
| wxPropertyContractService.endContract(wpc,this.getUser()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -101,7 +101,7 @@ public class ContractSchedule { | |||
| List<WxRentContract> contractList = wxRentContractService.findToEndContractList(record); | |||
| for (WxRentContract rent:contractList) { | |||
| try { | |||
| wxRentContractService.endContract(rent); | |||
| wxRentContractService.endContract(rent,null); | |||
| }catch(Exception e) { | |||
| log.error("rentcontract outDate error.",e); | |||
| } | |||
| @@ -123,7 +123,7 @@ public class ContractSchedule { | |||
| List<WxPropertyContract> contractList = wxPropertyContractService.findToEndContractList(record); | |||
| for (WxPropertyContract rent:contractList) { | |||
| try { | |||
| wxPropertyContractService.endContract(rent); | |||
| wxPropertyContractService.endContract(rent,null); | |||
| }catch(Exception e) { | |||
| log.error("rentcontract outDate error.",e); | |||
| } | |||
| @@ -59,6 +59,9 @@ public class WxBillRentManage extends WxBillBaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") | |||
| private Date applyUpdateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "预览账单0否1是", name = "isPreview") | |||
| private Integer isPreview; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") | |||
| private Integer isDel; | |||
| @@ -137,6 +140,7 @@ public class WxBillRentManage extends WxBillBaseEntity { | |||
| Date date = new Date(); | |||
| this.updateTenantInfo(billRent); | |||
| this.isDel = billRent.getIsDel(); | |||
| this.isPreview = billRent.getIsPreview(); | |||
| this.merchantId = billRent.getMerchantId(); | |||
| this.userId = billRent.getUserId(); | |||
| this.shopId = billRent.getShopId(); | |||
| @@ -45,5 +45,7 @@ public interface WxBillRentManageMapper extends CommonMapper<WxBillRentManage, L | |||
| WxBillRentManage selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void updatePreviewStatus(WxBillRentManage wxBillRentManage); | |||
| } | |||
| @@ -15,6 +15,7 @@ import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillNotify; | |||
| @@ -84,5 +85,6 @@ public interface WxBillDepositService { | |||
| public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); | |||
| public void returnDeposit(WxBillPayDTO dto, MallUserInfo user); | |||
| public void bad(WxBillPayDTO dto,MallUserInfo user); | |||
| public void rentContractStop(WxRentContract rentContract,MallUserInfo user); | |||
| } | |||
| @@ -15,6 +15,7 @@ import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillNotify; | |||
| @@ -86,4 +87,5 @@ public interface WxBillPropertyDepositService { | |||
| public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); | |||
| public void returnDeposit(WxBillPayDTO dto, MallUserInfo user); | |||
| public void bad(WxBillPayDTO dto,MallUserInfo user); | |||
| public void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user); | |||
| } | |||
| @@ -8,6 +8,8 @@ import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillNotify; | |||
| @@ -91,4 +93,5 @@ public interface WxBillPropertyService { | |||
| public void updatePay(WxBillPayDTO dto, MallUserInfo user); | |||
| public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); | |||
| public void bad(WxBillPayDTO dto,MallUserInfo user); | |||
| public void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user); | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxBillRentManage; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillNotify; | |||
| @@ -91,4 +92,5 @@ public interface WxBillRentManageService { | |||
| public void updatePay(WxBillPayDTO dto, MallUserInfo user); | |||
| public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); | |||
| public void bad(WxBillPayDTO dto,MallUserInfo user); | |||
| public void rentContractStop(WxRentContract rentContract,MallUserInfo user); | |||
| } | |||
| @@ -94,7 +94,5 @@ public interface WxBillRentService { | |||
| void updatePay(WxBillPayDTO dto,MallUserInfo user); | |||
| void updatePayByMerchant(WxBillPayDTO dto,WxMerchantBUser user,boolean isOnline); | |||
| void bad(WxBillPayDTO dto,MallUserInfo user); | |||
| void rentContractBillStop(WxRentContract rentContract); | |||
| void rentContractStop(WxRentContract rentContract,MallUserInfo user); | |||
| } | |||
| @@ -67,7 +67,7 @@ public interface WxPropertyContractService { | |||
| ResultData updatePropertyContractStatus(Long id); | |||
| void endContract(WxPropertyContract wxPropertyContract); | |||
| void endContract(WxPropertyContract wxPropertyContract,MallUserInfo userInfo); | |||
| void updatePropertyPreviewBill(WxPropertyContract record); | |||
| @@ -92,7 +92,7 @@ public interface WxRentContractService { | |||
| //Integer getShopType(WxRentContract wxRentContract); | |||
| ResultData endContract(WxRentContract wxRentContract); | |||
| ResultData endContract(WxRentContract wxRentContract,MallUserInfo userInfo); | |||
| void updatePropertyPreviewBill(WxRentContract record); | |||
| @@ -47,6 +47,7 @@ import com.iformall.enums.EnumBillDailyType; | |||
| import com.iformall.enums.EnumBillStatus; | |||
| import com.iformall.enums.EnumBillType; | |||
| import com.iformall.enums.EnumRentContractManageFeeType; | |||
| import com.iformall.enums.EnumSystemUserType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillDailyService; | |||
| @@ -955,7 +956,7 @@ public class WxBillAllHelper { | |||
| /** | |||
| * 退租: | |||
| * 账单开始时间>= 今天,并且账单是 WAIT_PAY,NOT_PAID,NOT_EXPIRED,BAD 变为INVALID | |||
| * 账单开始时间>= 今天,并且账单是 WAIT_PAY,NOT_PAID,NOT_EXPIRED,BAD 变为INVALID,如果已付了款,需要退回 | |||
| * 账单开始时间<今天 & 账单结束时间 > 今天: | |||
| * 账单 WAIT_PAY,NOT_PAID,NOT_EXPIRED,BAD 的,需要计算截止到今天账单总金额是多少钱,更新实际应收金额,并记录日志 | |||
| * 账单 PAID, 需要计算截止到今天账单总金额是多少钱,更新实际应收金额,并记录日志 | |||
| @@ -963,32 +964,42 @@ public class WxBillAllHelper { | |||
| * 那是之前的账单,不处理。 | |||
| * @param merchant | |||
| */ | |||
| public boolean billEndCalcute(Date endTime,WxBillBaseEntity bill,WxBillAction action) { | |||
| public boolean billEndCalcute(Integer decimalSize,Date endTime,WxBillBaseEntity bill,WxBillAction action, boolean isAllReturn) { | |||
| String endTimeStr = DateUtils.date2String(endTime,DateUtils.DATE_TIME_PATTERN); | |||
| boolean isPaid = false; | |||
| if (StringUtils.isNotBlank(bill.getPay()) && new BigDecimal(bill.getPay()).compareTo(new BigDecimal(0)) > 0 ) { | |||
| isPaid = true; | |||
| } | |||
| boolean isUpdate = false; | |||
| action.setBillId(bill.getId()); | |||
| action.setBillType(bill.getBillType()); | |||
| String oldReceivePay = bill.getReceivePay(); | |||
| if (!bill.getStarttime().before(endTime)) { | |||
| if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue() || bill.getStatus().intValue() == EnumBillStatus.NOT_PAID.getCode().intValue() || | |||
| bill.getStatus().intValue() == EnumBillStatus.NOT_EXPIRED.getCode().intValue() || bill.getStatus().intValue() == EnumBillStatus.BAD.getCode().intValue()) { | |||
| EnumBillStatus realBillStatus = EnumBillStatus.INVALID; | |||
| String newReceivePay = bill.getReceivePay(); | |||
| if (isPaid) { | |||
| realBillStatus = EnumBillStatus.STOP_TO_SETTLE; | |||
| bill.setReceivePay("0"); | |||
| newReceivePay = "0"; | |||
| } | |||
| bill.setStatus(realBillStatus.getCode()); | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney(newReceivePay); | |||
| action.setAction(EnumBillAction.STATUS_CHANGE.getCode()); | |||
| action.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null, null)+"商户停用,停用日期["+endTimeStr+"]"); | |||
| action.setRemark("系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+realBillStatus.getMessage()+"]"); | |||
| action.setRemark("系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+realBillStatus.getMessage()+"],应收金额变为0"); | |||
| isUpdate = true; | |||
| //如果是已支付,则需退回全部费用 | |||
| }else if (bill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||
| bill.setReceivePay("0"); | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney("0"); | |||
| action.setAction(EnumBillAction.UPDATE_BILL.getCode()); | |||
| action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(bill.getReceivePay(), "0", null)); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],原账单已结清,系统自动更新应收金额为0,待退回费用"); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| isUpdate = true; | |||
| }else { | |||
| //do nothing | |||
| @@ -996,22 +1007,26 @@ public class WxBillAllHelper { | |||
| }else if (bill.getStarttime().before(endTime) && bill.getEndtime().after(endTime)){ | |||
| int realDays = DateUtils.daysBetween(bill.getStarttime(),endTime); | |||
| int billDays = DateUtils.daysBetween(bill.getStarttime(),bill.getEndtime()); | |||
| String newReceivePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(realDays)).divide(new BigDecimal(billDays)).setScale(2,RoundingMode.HALF_UP).toPlainString(); | |||
| String oldReceivePay = bill.getReceivePay(); | |||
| String newReceivePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(realDays)).divide(new BigDecimal(billDays)).setScale(decimalSize,RoundingMode.HALF_UP).toPlainString(); | |||
| if (isAllReturn) { | |||
| newReceivePay = "0"; | |||
| } | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney(newReceivePay); | |||
| if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue() || bill.getStatus().intValue() == EnumBillStatus.NOT_PAID.getCode().intValue() || | |||
| bill.getStatus().intValue() == EnumBillStatus.NOT_EXPIRED.getCode().intValue() || bill.getStatus().intValue() == EnumBillStatus.BAD.getCode().intValue()) { | |||
| bill.setReceivePay(newReceivePay); | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setAction(EnumBillAction.UPDATE_BILL.getCode()); | |||
| action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldReceivePay, newReceivePay, null)); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动更新"); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| isUpdate = true; | |||
| }else if (bill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||
| bill.setReceivePay(newReceivePay); | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setAction(EnumBillAction.UPDATE_BILL.getCode()); | |||
| action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldReceivePay, newReceivePay, null)); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动更新"); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| isUpdate = true; | |||
| }else { | |||
| //do nothing | |||
| @@ -1019,11 +1034,44 @@ public class WxBillAllHelper { | |||
| }else { | |||
| if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue() || bill.getStatus().intValue() == EnumBillStatus.NOT_PAID.getCode().intValue() || | |||
| bill.getStatus().intValue() == EnumBillStatus.NOT_EXPIRED.getCode().intValue()) { | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setAction(EnumBillAction.STATUS_CHANGE.getCode()); | |||
| action.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null, null)+"商户停用,停用日期["+endTimeStr+"]"); | |||
| action.setRemark("系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| if (isAllReturn) { | |||
| if (isPaid) { | |||
| bill.setReceivePay("0"); | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney("0"); | |||
| action.setAction(EnumBillAction.UPDATE_BILL.getCode()); | |||
| action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldReceivePay, "0", null)); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| }else { | |||
| bill.setReceivePay("0"); | |||
| bill.setStatus(EnumBillStatus.INVALID.getCode()); | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney("0"); | |||
| action.setAction(EnumBillAction.STATUS_CHANGE.getCode()); | |||
| action.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null, null)+"商户停用,停用日期["+endTimeStr+"]"); | |||
| action.setRemark("系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.INVALID.getMessage()+"],应收金额变为0"); | |||
| } | |||
| }else { | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney("0"); | |||
| action.setAction(EnumBillAction.STATUS_CHANGE.getCode()); | |||
| action.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null, null)+"商户停用,停用日期["+endTimeStr+"]"); | |||
| action.setRemark("系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| } | |||
| isUpdate = true; | |||
| }else if (bill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { | |||
| if (isAllReturn) { | |||
| bill.setReceivePay("0"); | |||
| bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||
| action.setOldMoney(oldReceivePay); | |||
| action.setNewMoney("0"); | |||
| action.setAction(EnumBillAction.UPDATE_BILL.getCode()); | |||
| action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldReceivePay, "0", null)); | |||
| action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); | |||
| isUpdate = true; | |||
| } | |||
| }else { | |||
| //do nothing | |||
| } | |||
| @@ -1031,14 +1079,38 @@ public class WxBillAllHelper { | |||
| return isUpdate; | |||
| } | |||
| private MallUserInfo getSystemUser(TenantEntity tenantEntity) { | |||
| MallUserInfo user = new MallUserInfo(); | |||
| user.updateTenantInfo(tenantEntity); | |||
| user.setId(Constant.SYS_SERVER); | |||
| user.setName("SYSTEM"); | |||
| user.setPhone("00000000000"); | |||
| return user; | |||
| } | |||
| //租赁合同终止, 租赁押金需全部退回,租金账单,营业管理费,商业管理费账单需重新计算。 | |||
| public void rentContractStop(WxRentContract rentContract) { | |||
| public void rentContractStop(WxRentContract rentContract,MallUserInfo user) { | |||
| if (null == user) { | |||
| user = getSystemUser(rentContract); | |||
| } | |||
| //根据合同查询租金账单,重新计算账单 | |||
| wxBillRentService.rentContractStop(rentContract, user); | |||
| //营业管理费/商业管理费 | |||
| wxBillRentManageService.rentContractStop(rentContract, user); | |||
| //租赁押金 | |||
| wxBillRentDepositService.rentContractStop(rentContract, user); | |||
| } | |||
| //物业合同终止,物业押金需全额退回,物业账单需重新计算 | |||
| public void propertyContractStop(WxPropertyContract propertyContract) { | |||
| public void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user) { | |||
| if (null == user) { | |||
| user = getSystemUser(propertyContract); | |||
| } | |||
| //物业账单 | |||
| wxBillPropertyService.propertyContractStop(propertyContract, user); | |||
| //物业押金 | |||
| wxBillPropertyDepositService.propertyContractStop(propertyContract, user); | |||
| } | |||
| //终止商户除了租赁账单以外的 | |||
| @@ -53,4 +53,18 @@ public class WxBillBaseService{ | |||
| wxBillActionService.modifyBill(wxBillAction, bUser); | |||
| } | |||
| protected void addBillAction(WxBillAction wxBillAction, MallUserInfo mallUserInfo) { | |||
| //wxBillAction.setBillId(billId); | |||
| //wxBillAction.setBillType(billType); | |||
| //wxBillAction.setOldMoney(oldMoney); | |||
| //wxBillAction.setNewMoney(newMoney); | |||
| //wxBillAction.setDetails(billAction.getDescription(oldMoney, newMoney,payWay)); | |||
| //wxBillAction.setAction(billAction.getCode()); | |||
| //wxBillAction.setPayDate(payDate); | |||
| //wxBillAction.setPayWay(payWay); | |||
| //wxBillAction.setRemark(remark); | |||
| wxBillAction.setUserType(EnumSystemUserType.ADMIN.getCode()); | |||
| wxBillActionService.modifyBill(wxBillAction, mallUserInfo); | |||
| } | |||
| } | |||
| @@ -39,6 +39,7 @@ import com.iformall.service.WxBillDepositService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.service.WxShopService; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -91,6 +92,10 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| @Autowired | |||
| WxRentContractMapper wxRentContractMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @Override | |||
| public PageInfo<WxBillDeposit> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| @@ -568,4 +573,35 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| badMoney, badMoney,null,null,dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| public void rentContractStop(WxRentContract rentContract, MallUserInfo user) { | |||
| WxBillDeposit br = new WxBillDeposit(); | |||
| br.setRentContractId(rentContract.getId()); | |||
| br.updateTenantInfo(rentContract); | |||
| List<WxBillDeposit> brList = wxBillDepositMapper.findList(br); | |||
| List<WxBillDeposit> realRentList = new ArrayList<WxBillDeposit>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| if (null != brList && brList.size() > 0 ) { | |||
| for (int i = 0 ; i < brList.size() ; i ++ ) { | |||
| WxBillDeposit brent = brList.get(i); | |||
| WxBillAction action = new WxBillAction(); | |||
| boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, true); | |||
| if (isUpdate) { | |||
| realRentList.add(brent); | |||
| actionList.add(action); | |||
| } | |||
| } | |||
| } | |||
| for (int i = 0 ; i < realRentList.size() ; i ++) { | |||
| WxBillDeposit rbrent = realRentList.get(i); | |||
| wxBillDepositMapper.updateById(rbrent); | |||
| } | |||
| for (int i = 0 ; i < actionList.size() ; i ++) { | |||
| WxBillAction ba = actionList.get(i); | |||
| this.addBillAction(ba, user); | |||
| } | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.dto.WxBillReceiveUpdateDTO; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| @@ -38,6 +39,7 @@ import com.iformall.service.WxBillPropertyDepositService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.service.WxShopService; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -50,6 +52,7 @@ import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -84,6 +87,10 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @Override | |||
| public PageInfo<WxBillPropertyDeposit> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| @@ -547,5 +554,36 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| badMoney, badMoney,null,null,dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| public void propertyContractStop(WxPropertyContract propertyContract, MallUserInfo user) { | |||
| WxBillPropertyDeposit br = new WxBillPropertyDeposit(); | |||
| br.setPropertyContractId(propertyContract.getId()); | |||
| br.updateTenantInfo(propertyContract); | |||
| List<WxBillPropertyDeposit> brList = wxBillPropertyDepositMapper.findList(br); | |||
| List<WxBillPropertyDeposit> realRentList = new ArrayList<WxBillPropertyDeposit>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| if (null != brList && brList.size() > 0 ) { | |||
| for (int i = 0 ; i < brList.size() ; i ++ ) { | |||
| WxBillPropertyDeposit brent = brList.get(i); | |||
| WxBillAction action = new WxBillAction(); | |||
| boolean isUpdate = wxBillAllHelper.billEndCalcute(propertyContract.getDecimalSize(),propertyContract.getEndContractTime(), brent, action, true); | |||
| if (isUpdate) { | |||
| realRentList.add(brent); | |||
| actionList.add(action); | |||
| } | |||
| } | |||
| } | |||
| for (int i = 0 ; i < realRentList.size() ; i ++) { | |||
| WxBillPropertyDeposit rbrent = realRentList.get(i); | |||
| wxBillPropertyDepositMapper.updateById(rbrent); | |||
| } | |||
| for (int i = 0 ; i < actionList.size() ; i ++) { | |||
| WxBillAction ba = actionList.get(i); | |||
| this.addBillAction(ba, user); | |||
| } | |||
| } | |||
| } | |||
| @@ -22,6 +22,7 @@ import com.iformall.mapper.WxBillPropertyDepositMapper; | |||
| import com.iformall.mapper.WxBillPropertyMapper; | |||
| import com.iformall.mapper.WxPropertyContractMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| @@ -76,6 +77,10 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| @Lazy | |||
| @Autowired | |||
| WxShopService wxShopService; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @Override | |||
| @@ -637,4 +642,35 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), | |||
| badMoney, badMoney,null,null,dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| public void propertyContractStop(WxPropertyContract propertyContract, MallUserInfo user) { | |||
| WxBillProperty br = new WxBillProperty(); | |||
| br.setPropertyContractId(propertyContract.getId()); | |||
| br.updateTenantInfo(propertyContract); | |||
| List<WxBillProperty> brList = wxBillPropertyMapper.findList(br); | |||
| List<WxBillProperty> realRentList = new ArrayList<WxBillProperty>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| if (null != brList && brList.size() > 0 ) { | |||
| for (int i = 0 ; i < brList.size() ; i ++ ) { | |||
| WxBillProperty brent = brList.get(i); | |||
| WxBillAction action = new WxBillAction(); | |||
| boolean isUpdate = wxBillAllHelper.billEndCalcute(propertyContract.getDecimalSize() ,propertyContract.getEndContractTime(), brent, action, false); | |||
| if (isUpdate) { | |||
| realRentList.add(brent); | |||
| actionList.add(action); | |||
| } | |||
| } | |||
| } | |||
| for (int i = 0 ; i < realRentList.size() ; i ++) { | |||
| WxBillProperty rbrent = realRentList.get(i); | |||
| wxBillPropertyMapper.updateById(rbrent); | |||
| } | |||
| for (int i = 0 ; i < actionList.size() ; i ++) { | |||
| WxBillAction ba = actionList.get(i); | |||
| this.addBillAction(ba, user); | |||
| } | |||
| } | |||
| } | |||
| @@ -32,6 +32,7 @@ import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillRentManageService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -78,6 +79,10 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||
| @Autowired | |||
| WxRentContractMapper wxRentContractMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @Override | |||
| public PageInfo<WxBillRentManage> listAsPage(WxBillRentManage wxBillRentManage, Integer pageIndex, Integer pageSize) { | |||
| @@ -567,5 +572,37 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||
| this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), | |||
| badMoney, badMoney,null,null,dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| public void rentContractStop(WxRentContract rentContract,MallUserInfo user) { | |||
| WxBillRentManage br = new WxBillRentManage(); | |||
| br.setRentContractId(rentContract.getId()); | |||
| br.updateTenantInfo(rentContract); | |||
| br.setIsPreview(EnumIsPreview.NO.getCode()); | |||
| List<WxBillRentManage> brList = wxBillRentManageMapper.findList(br); | |||
| List<WxBillRentManage> realRentList = new ArrayList<WxBillRentManage>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| if (null != brList && brList.size() > 0 ) { | |||
| for (int i = 0 ; i < brList.size() ; i ++ ) { | |||
| WxBillRentManage brent = brList.get(i); | |||
| WxBillAction action = new WxBillAction(); | |||
| boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, false); | |||
| if (isUpdate) { | |||
| realRentList.add(brent); | |||
| actionList.add(action); | |||
| } | |||
| } | |||
| } | |||
| for (int i = 0 ; i < realRentList.size() ; i ++) { | |||
| WxBillRentManage rbrent = realRentList.get(i); | |||
| wxBillRentManageMapper.updateById(rbrent); | |||
| } | |||
| for (int i = 0 ; i < actionList.size() ; i ++) { | |||
| WxBillAction ba = actionList.get(i); | |||
| this.addBillAction(ba, user); | |||
| } | |||
| } | |||
| } | |||
| @@ -19,6 +19,7 @@ import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -74,6 +75,10 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| @Lazy | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @Override | |||
| public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| @@ -733,17 +738,35 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| } | |||
| @Override | |||
| public void rentContractBillStop(WxRentContract rentContract) { | |||
| WxBillRent rq = new WxBillRent(); | |||
| rq.updateTenantInfo(rentContract); | |||
| rq.setRentContractId(rentContract.getId()); | |||
| List<WxBillRent> rentList = wxBillRentMapper.findList(rq); | |||
| if (null != rentList) { | |||
| for (int i = 0 ; i < rentList.size() ; i ++) { | |||
| } | |||
| } | |||
| public void rentContractStop(WxRentContract rentContract,MallUserInfo user) { | |||
| WxBillRent br = new WxBillRent(); | |||
| br.setRentContractId(rentContract.getId()); | |||
| br.updateTenantInfo(rentContract); | |||
| br.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| List<WxBillRent> brList = wxBillRentMapper.findList(br); | |||
| List<WxBillRent> realRentList = new ArrayList<WxBillRent>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| if (null != brList && brList.size() > 0 ) { | |||
| for (int i = 0 ; i < brList.size() ; i ++ ) { | |||
| WxBillRent brent = brList.get(i); | |||
| WxBillAction action = new WxBillAction(); | |||
| boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, false); | |||
| if (isUpdate) { | |||
| realRentList.add(brent); | |||
| actionList.add(action); | |||
| } | |||
| } | |||
| } | |||
| for (int i = 0 ; i < realRentList.size() ; i ++) { | |||
| WxBillRent rbrent = realRentList.get(i); | |||
| wxBillRentMapper.updateById(rbrent); | |||
| } | |||
| for (int i = 0 ; i < actionList.size() ; i ++) { | |||
| WxBillAction ba = actionList.get(i); | |||
| this.addBillAction(ba, user); | |||
| } | |||
| } | |||
| } | |||
| @@ -306,7 +306,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| //终止租赁合同,同时终止物业合同 | |||
| Integer endProperty = getIngeter(getVariableByKey(variables,"endProperty")); | |||
| rent.setEndProperty(endProperty); | |||
| wxRentContractService.endContract(rent); | |||
| wxRentContractService.endContract(rent,null); | |||
| } | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType) || EnumFlowContractType.PROPERTY_POINT.getCode().equals(contractType)){ | |||
| @@ -319,7 +319,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.TERMINATE.getCode()); | |||
| //账单失效 | |||
| wxPropertyContractService.endContract(wxPropertyContract); | |||
| wxPropertyContractService.endContract(wxPropertyContract,null); | |||
| } | |||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | |||
| } | |||
| @@ -1113,14 +1113,14 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| } | |||
| @Override | |||
| public void endContract(WxPropertyContract wxPropertyContract) { | |||
| public void endContract(WxPropertyContract wxPropertyContract,MallUserInfo userInfo) { | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.TERMINATE.getCode()); | |||
| wxPropertyContractMapper.updateStatus(wxPropertyContract); | |||
| // WxBillProperty wxBillProperty = new WxBillProperty(); | |||
| // wxBillProperty.setPropertyContractId(wxPropertyContract.getId()); | |||
| // wxBillPropertyMapper.updateInvalidStatus(wxBillProperty); | |||
| wxBillAllHelper.propertyContractStop(wxPropertyContract); | |||
| wxBillAllHelper.propertyContractStop(wxPropertyContract,userInfo); | |||
| } | |||
| @Override | |||
| @@ -545,7 +545,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //创建预览账单 | |||
| // List<WxBillRent> resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true); | |||
| // record.setPreviewBillRentList(resultList); | |||
| EventUtil.publistRentEvent(this, record); | |||
| //EventUtil.publistRentEvent(this, record); | |||
| return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); | |||
| } | |||
| @@ -1784,7 +1784,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData endContract(WxRentContract wxRentContract) { | |||
| public ResultData endContract(WxRentContract wxRentContract,MallUserInfo userInfo) { | |||
| WxRentContract contract = wxRentContractMapper.selectById(wxRentContract.getId()); | |||
| if (contract == null) { | |||
| @@ -1821,7 +1821,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillPropertyMapper.updateInvalidStatusByRent(wxRentContract); | |||
| } | |||
| //租赁账单失效 | |||
| wxBillAllHelper.rentContractStop(wxRentContract); | |||
| wxBillAllHelper.rentContractStop(wxRentContract,userInfo); | |||
| // WxBillRent wxBillRent = new WxBillRent(); | |||
| // wxBillRent.setRentContractId(wxRentContract.getId()); | |||
| // wxBillRent.updateTenantInfo(wxRentContract); | |||
| @@ -2001,7 +2001,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContract.setStatus(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||
| } | |||
| wxRentContractMapper.updateById(wxRentContract); | |||
| EventUtil.publistRentEvent(this, wxRentContract); | |||
| //EventUtil.publistRentEvent(this, wxRentContract); | |||
| //建立账单 | |||
| //自定义账单无单价,为能生成账单,设置该值 | |||
| if (EnumRentContractType.RENT_BY_CUSTOMIZE.getCode() == record.getType()) { | |||
| @@ -2020,6 +2020,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| // WxMerchant wxMerchant = new WxMerchant(); | |||
| // wxMerchant.setId(record.getMerchantId()); | |||
| // wxMerchant.updateTenantInfo(record); | |||
| //商业管理费,营业管理费 | |||
| WxBillRentManage billRentManage = new WxBillRentManage(); | |||
| billRentManage.setRentContractId(id); | |||
| billRentManage.setIsPreview(EnumIsPreview.NO.getCode()); | |||
| billRentManage.updateTenantInfo(record); | |||
| wxBillRentManageMapper.updatePreviewStatus(billRentManage); | |||
| if(new BigDecimal(record.getDeposit()).compareTo(new BigDecimal(0)) > 0) { | |||
| //押金 | |||
| buildDeposit( null, id); | |||
| @@ -5,6 +5,7 @@ public class Constant { | |||
| /** 系统管理员ID */ | |||
| public static final Long SUPER_ADMIN = 1L; // 富茂超管 | |||
| public static final String FM_SYS_ADMIN = "1"; // 富茂管理员 | |||
| public static final Long SYS_SERVER = 999L; //虚拟系统服务用户 | |||
| public static final int SYS_MENU_MAX = 2000; // 系统菜单最大值 | |||
| @@ -16,6 +16,7 @@ | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_preview" jdbcType="INTEGER" property="isPreview"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| @@ -42,9 +43,9 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`last_owe_call_user`, | |||
| `createtime`,`expired_day`,`status`,`apply_status`,`apply_pay_img`,`apply_update_time`,`is_del`,`need_pay`,`last_owe_call_time`, | |||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`, | |||
| `period`,`shop_info`,`pay_way`,`late_pay_status`,starttime,endtime,freeze,service_charge_pay,manage_fee_type | |||
| `createtime`,`expired_day`,`status`,`apply_status`,`apply_pay_img`,`apply_update_time`,`is_del`,`is_preview`,`need_pay`, | |||
| `last_owe_call_time`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`late_pay_ratio`,`late_pay_time`, | |||
| `late_pay_price`,`period`,`shop_info`,`pay_way`,`late_pay_status`,starttime,endtime,freeze,service_charge_pay,manage_fee_type | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -65,6 +66,7 @@ | |||
| <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != needPay ">and `need_pay` = #{needPay}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| @@ -114,7 +116,7 @@ | |||
| <sql id="queryBillManageListConditions"> | |||
| <where> | |||
| 1 = 1 | |||
| br.`is_preview` = 0 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| @@ -221,6 +223,10 @@ | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| </select> | |||
| <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxBillRentManage"> | |||
| update wx_bill_rent_manage set is_preview = #{isPreview} where rent_contract_id = #{rentContractId} | |||
| </update> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_manage | |||