| @@ -76,5 +76,12 @@ public class WxBillDepositController extends BaseController { | |||||
| return wxBillDepositService.updatePaid(id); | return wxBillDepositService.updatePaid(id); | ||||
| } | } | ||||
| @PostMapping("returnDeposit") | |||||
| public ResultData returnDeposit(@RequestBody WxBillDeposit wxBillDeposit) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::returnDeposit"); | |||||
| return wxBillDepositService.returnDeposit(wxBillDeposit); | |||||
| } | |||||
| } | } | ||||
| @@ -76,5 +76,11 @@ public class WxBillPropertyController extends BaseController { | |||||
| return wxBillPropertyService.updatePaid(id); | return wxBillPropertyService.updatePaid(id); | ||||
| } | } | ||||
| @GetMapping("/detail") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData detail(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::detail"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.detail(id)); | |||||
| } | |||||
| } | } | ||||
| @@ -76,6 +76,15 @@ public class WxBillPropertyDepositController extends BaseController | |||||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::updatePaid"); | logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::updatePaid"); | ||||
| return wxBillPropertyDepositService.updatePaid(id); | return wxBillPropertyDepositService.updatePaid(id); | ||||
| } | } | ||||
| @PostMapping("returnDeposit") | |||||
| public ResultData returnDeposit(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::returnDeposit"); | |||||
| return wxBillPropertyDepositService.returnDeposit(wxBillPropertyDeposit); | |||||
| } | |||||
| } | } | ||||
| @@ -82,4 +82,11 @@ public class WxBillRentController extends BaseController { | |||||
| return wxBillRentService.updatePaid(id); | return wxBillRentService.updatePaid(id); | ||||
| } | } | ||||
| @GetMapping("/detail") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData detail(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::detail"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.detail(id)); | |||||
| } | |||||
| } | } | ||||
| @@ -101,6 +101,9 @@ public class WxBillDeposit implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | ||||
| private Integer rentShopType; | private Integer rentShopType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") | |||||
| private Integer returnPrice; | |||||
| public Date getStarttime() { | public Date getStarttime() { | ||||
| return starttime; | return starttime; | ||||
| } | } | ||||
| @@ -230,6 +233,14 @@ public class WxBillDeposit implements Serializable { | |||||
| this.rentShopType = rentShopType; | this.rentShopType = rentShopType; | ||||
| } | } | ||||
| public Integer getReturnPrice() { | |||||
| return returnPrice; | |||||
| } | |||||
| public void setReturnPrice(Integer returnPrice) { | |||||
| this.returnPrice = returnPrice; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -101,6 +101,21 @@ public class WxBillProperty implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | ||||
| private Integer rentShopType; | private Integer rentShopType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") | |||||
| private Integer revenue; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") | |||||
| private Integer latePayRatio; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime") | |||||
| private Date latePayTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") | |||||
| private Integer latePayPrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账期", name = "period") | |||||
| private Integer period; | |||||
| public Date getStarttime() { | public Date getStarttime() { | ||||
| return starttime; | return starttime; | ||||
| } | } | ||||
| @@ -233,6 +248,46 @@ public class WxBillProperty implements Serializable { | |||||
| this.rentShopType = rentShopType; | this.rentShopType = rentShopType; | ||||
| } | } | ||||
| public Integer getRevenue() { | |||||
| return revenue; | |||||
| } | |||||
| public void setRevenue(Integer revenue) { | |||||
| this.revenue = revenue; | |||||
| } | |||||
| public Integer getLatePayRatio() { | |||||
| return latePayRatio; | |||||
| } | |||||
| public void setLatePayRatio(Integer latePayRatio) { | |||||
| this.latePayRatio = latePayRatio; | |||||
| } | |||||
| public Date getLatePayTime() { | |||||
| return latePayTime; | |||||
| } | |||||
| public void setLatePayTime(Date latePayTime) { | |||||
| this.latePayTime = latePayTime; | |||||
| } | |||||
| public Integer getLatePayPrice() { | |||||
| return latePayPrice; | |||||
| } | |||||
| public void setLatePayPrice(Integer latePayPrice) { | |||||
| this.latePayPrice = latePayPrice; | |||||
| } | |||||
| public Integer getPeriod() { | |||||
| return period; | |||||
| } | |||||
| public void setPeriod(Integer period) { | |||||
| this.period = period; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -101,6 +101,9 @@ public class WxBillPropertyDeposit implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | ||||
| private Integer rentShopType; | private Integer rentShopType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") | |||||
| private Integer returnPrice; | |||||
| public Date getStarttime() { | public Date getStarttime() { | ||||
| return starttime; | return starttime; | ||||
| } | } | ||||
| @@ -232,6 +235,14 @@ public class WxBillPropertyDeposit implements Serializable { | |||||
| this.rentShopType = rentShopType; | this.rentShopType = rentShopType; | ||||
| } | } | ||||
| public Integer getReturnPrice() { | |||||
| return returnPrice; | |||||
| } | |||||
| public void setReturnPrice(Integer returnPrice) { | |||||
| this.returnPrice = returnPrice; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -103,6 +103,21 @@ public class WxBillRent implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | ||||
| private Integer rentShopType; | private Integer rentShopType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") | |||||
| private Integer revenue; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") | |||||
| private Integer latePayRatio; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime") | |||||
| private Date latePayTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") | |||||
| private Integer latePayPrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账期", name = "period") | |||||
| private Integer period; | |||||
| public Date getStarttime() { | public Date getStarttime() { | ||||
| return starttime; | return starttime; | ||||
| } | } | ||||
| @@ -234,6 +249,46 @@ public class WxBillRent implements Serializable { | |||||
| this.rentShopType = rentShopType; | this.rentShopType = rentShopType; | ||||
| } | } | ||||
| public Integer getRevenue() { | |||||
| return revenue; | |||||
| } | |||||
| public void setRevenue(Integer revenue) { | |||||
| this.revenue = revenue; | |||||
| } | |||||
| public Integer getLatePayRatio() { | |||||
| return latePayRatio; | |||||
| } | |||||
| public void setLatePayRatio(Integer latePayRatio) { | |||||
| this.latePayRatio = latePayRatio; | |||||
| } | |||||
| public Date getLatePayTime() { | |||||
| return latePayTime; | |||||
| } | |||||
| public void setLatePayTime(Date latePayTime) { | |||||
| this.latePayTime = latePayTime; | |||||
| } | |||||
| public Integer getLatePayPrice() { | |||||
| return latePayPrice; | |||||
| } | |||||
| public void setLatePayPrice(Integer latePayPrice) { | |||||
| this.latePayPrice = latePayPrice; | |||||
| } | |||||
| public Integer getPeriod() { | |||||
| return period; | |||||
| } | |||||
| public void setPeriod(Integer period) { | |||||
| this.period = period; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -11,6 +11,7 @@ public enum EnumBillDailyStatus { | |||||
| WAIT_PAY(2,"待缴"), | WAIT_PAY(2,"待缴"), | ||||
| PAID(3, "已结清"), | PAID(3, "已结清"), | ||||
| NOT_EXPIRED(4,"未到期"), | NOT_EXPIRED(4,"未到期"), | ||||
| RETURN(5, "退还"), | |||||
| ; | ; | ||||
| public static EnumBillDailyStatus getEnum(Integer code) { | public static EnumBillDailyStatus getEnum(Integer code) { | ||||
| @@ -43,10 +43,8 @@ public interface WxBillDepositService { | |||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| ResultData updatePaid(Long id); | ResultData updatePaid(Long id); | ||||
| ResultData returnDeposit(WxBillDeposit wxBillDeposit); | |||||
| } | } | ||||
| @@ -49,11 +49,6 @@ public interface WxBillPropertyDepositService { | |||||
| ResultData updatePaid(Long id); | ResultData updatePaid(Long id); | ||||
| ResultData returnDeposit(WxBillPropertyDeposit wxBillPropertyDeposit); | |||||
| } | } | ||||
| @@ -51,8 +51,7 @@ public interface WxBillPropertyService { | |||||
| Object findByMerchantId(Long id); | Object findByMerchantId(Long id); | ||||
| ResultData updatePaid(Long id); | ResultData updatePaid(Long id); | ||||
| Object detail(Long id); | |||||
| } | } | ||||
| @@ -49,4 +49,6 @@ public interface WxBillRentService { | |||||
| ResultData updatePaid(Long id); | ResultData updatePaid(Long id); | ||||
| Object detail(Long id); | |||||
| } | } | ||||
| @@ -160,10 +160,26 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "租赁押金结单成功"); | return new ResultData(Result.SUCCESS, "租赁押金结单成功"); | ||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| @Override | |||||
| public ResultData returnDeposit(WxBillDeposit record) { | |||||
| logger.info("租赁押金退还"); | |||||
| WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectByPrimaryKey(record.getId()); | |||||
| if (wxBillDeposit == null) { | |||||
| return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); | |||||
| } | |||||
| wxBillDeposit.setReturnPrice(record.getReturnPrice()); | |||||
| wxBillDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||||
| wxBillDeposit.setUpdatetime(new Date()); | |||||
| try { | |||||
| wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | |||||
| } catch (Exception e) { | |||||
| logger.error("租赁押金退还失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "租赁押金退还成功", wxBillDeposit); | |||||
| } | |||||
| } | } | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxBillDeposit; | |||||
| import com.iformall.domain.po.WxBillPropertyDeposit; | import com.iformall.domain.po.WxBillPropertyDeposit; | ||||
| import com.iformall.enums.EnumBillRentStatus; | import com.iformall.enums.EnumBillRentStatus; | ||||
| import com.iformall.enums.EnumDelStatus; | import com.iformall.enums.EnumDelStatus; | ||||
| @@ -161,10 +162,25 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "物业押金结单成功"); | return new ResultData(Result.SUCCESS, "物业押金结单成功"); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData returnDeposit(WxBillPropertyDeposit record) { | |||||
| logger.info("物业押金退还"); | |||||
| WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(record.getId()); | |||||
| if (wxBillDeposit == null) { | |||||
| return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); | |||||
| } | |||||
| wxBillDeposit.setReturnPrice(record.getReturnPrice()); | |||||
| wxBillDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||||
| wxBillDeposit.setUpdatetime(new Date()); | |||||
| try { | |||||
| wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | |||||
| } catch (Exception e) { | |||||
| logger.error("物业押金退还失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "物业押金退还成功", wxBillDeposit); | |||||
| } | |||||
| } | } | ||||
| @@ -6,10 +6,13 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxBillDeposit; | |||||
| import com.iformall.domain.po.WxBillProperty; | import com.iformall.domain.po.WxBillProperty; | ||||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||||
| import com.iformall.enums.EnumBillRentStatus; | import com.iformall.enums.EnumBillRentStatus; | ||||
| import com.iformall.enums.EnumDelStatus; | import com.iformall.enums.EnumDelStatus; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxBillPropertyDepositMapper; | |||||
| import com.iformall.mapper.WxBillPropertyMapper; | import com.iformall.mapper.WxBillPropertyMapper; | ||||
| import com.iformall.service.WxBillPropertyService; | import com.iformall.service.WxBillPropertyService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -33,6 +36,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||||
| @Autowired | @Autowired | ||||
| WxBillPropertyMapper wxBillPropertyMapper; | WxBillPropertyMapper wxBillPropertyMapper; | ||||
| @Autowired | |||||
| WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<Map<String, Object>> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | public PageInfo<Map<String, Object>> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | ||||
| //更新账单状态 | //更新账单状态 | ||||
| @@ -167,8 +173,22 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||||
| return new ResultData(Result.SUCCESS, "结单成功"); | return new ResultData(Result.SUCCESS, "结单成功"); | ||||
| } | } | ||||
| @Override | |||||
| public Object detail(Long id) { | |||||
| //物业 | |||||
| Map<String, Object> property = getById(id); | |||||
| //押金 | |||||
| WxBillPropertyDeposit depositParam = new WxBillPropertyDeposit(); | |||||
| depositParam.setPropertyContractId(id); | |||||
| Map<String, Object> deposit = wxBillPropertyDepositMapper.queryBillDepositList(depositParam).get(0); | |||||
| //周期 | |||||
| Object weekly = findByMerchantId((Long) property.get("merchantId")); | |||||
| Map<String, Object> result = new HashMap<>(3); | |||||
| result.put("property", property); | |||||
| result.put("deposit", deposit); | |||||
| result.put("weekly", weekly); | |||||
| return result; | |||||
| } | |||||
| } | } | ||||
| @@ -6,10 +6,12 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxBillDeposit; | |||||
| import com.iformall.domain.po.WxBillRent; | import com.iformall.domain.po.WxBillRent; | ||||
| import com.iformall.enums.EnumBillRentStatus; | import com.iformall.enums.EnumBillRentStatus; | ||||
| import com.iformall.enums.EnumDelStatus; | import com.iformall.enums.EnumDelStatus; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxBillDepositMapper; | |||||
| import com.iformall.mapper.WxBillRentMapper; | import com.iformall.mapper.WxBillRentMapper; | ||||
| import com.iformall.service.WxBillRentService; | import com.iformall.service.WxBillRentService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -33,6 +35,8 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| @Autowired | @Autowired | ||||
| WxBillRentMapper wxBillRentMapper; | WxBillRentMapper wxBillRentMapper; | ||||
| @Autowired | |||||
| WxBillDepositMapper wxBillDepositMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -168,4 +172,21 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| return new ResultData(Result.SUCCESS, "租赁账单结单成功"); | return new ResultData(Result.SUCCESS, "租赁账单结单成功"); | ||||
| } | } | ||||
| @Override | |||||
| public Object detail(Long id) { | |||||
| //租赁 | |||||
| Map<String, Object> rent = getById(id); | |||||
| //押金 | |||||
| WxBillDeposit depositParam = new WxBillDeposit(); | |||||
| depositParam.setRentContractId(id); | |||||
| Map<String, Object> deposit = wxBillDepositMapper.queryBillDepositList(depositParam).get(0); | |||||
| //周期 | |||||
| Object weekly = findByMerchantId((Long) rent.get("merchantId")); | |||||
| Map<String, Object> result = new HashMap<>(3); | |||||
| result.put("rent", rent); | |||||
| result.put("deposit", deposit); | |||||
| result.put("weekly", weekly); | |||||
| return result; | |||||
| } | |||||
| } | } | ||||
| @@ -407,6 +407,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| wxBillProperty.setCreatetime(date); | wxBillProperty.setCreatetime(date); | ||||
| wxBillProperty.setUpdatetime(date); | wxBillProperty.setUpdatetime(date); | ||||
| wxBillProperty.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | wxBillProperty.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| wxBillProperty.setPeriod(i + 1); | |||||
| try { | try { | ||||
| wxBillPropertyMapper.insertSelective(wxBillProperty); | wxBillPropertyMapper.insertSelective(wxBillProperty); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -389,7 +389,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price); | buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price); | ||||
| } else { | } else { | ||||
| //按日计租 | //按日计租 | ||||
| buildRent(lease, receivePeriod, price, rentalStartDate, Calendar.DAY_OF_MONTH, wxRentContract, userId, wxMerchant); | |||||
| buildRent(lease, receivePeriod, price, rentalStartDate, Calendar.DAY_OF_MONTH, wxRentContract, userId, wxMerchant, 0); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -417,16 +417,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| leaseArr[divide] = mod; | leaseArr[divide] = mod; | ||||
| } | } | ||||
| int billcount = 0; | |||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| Calendar instance = Calendar.getInstance(); | Calendar instance = Calendar.getInstance(); | ||||
| instance.setTime(rentalStartDate); | instance.setTime(rentalStartDate); | ||||
| //开始时间 | //开始时间 | ||||
| instance.add(Calendar.MONTH, month * i); | instance.add(Calendar.MONTH, month * i); | ||||
| buildRent(leaseArr[i], receivePeriod, priceArr[i], instance.getTime(), Calendar.MONTH, wxRentContract, userId, wxMerchant); | |||||
| billcount = buildRent(leaseArr[i], receivePeriod, priceArr[i], instance.getTime(), Calendar.MONTH, wxRentContract, userId, wxMerchant, billcount); | |||||
| } | } | ||||
| } | } | ||||
| public void buildRent(int lease, int receivePeriod, int price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant) { | |||||
| public int buildRent(int lease, int receivePeriod, int price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount) { | |||||
| int extralease = lease % receivePeriod; | int extralease = lease % receivePeriod; | ||||
| int extracount = extralease > 0 ? 1 : 0; | int extracount = extralease > 0 ? 1 : 0; | ||||
| @@ -506,6 +507,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxBillRent.setUpdatetime(date); | wxBillRent.setUpdatetime(date); | ||||
| wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| wxBillRent.setRentShopType(wxRentContract.getRentShopType()); | wxBillRent.setRentShopType(wxRentContract.getRentShopType()); | ||||
| wxBillRent.setPeriod(++billcount); | |||||
| try { | try { | ||||
| wxBillRentMapper.insertSelective(wxBillRent); | wxBillRentMapper.insertSelective(wxBillRent); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -513,7 +515,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| return billcount; | |||||
| } | } | ||||
| @@ -20,13 +20,14 @@ | |||||
| <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | ||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | ||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="return_price" jdbcType="INTEGER" property="returnPrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`, | `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`, | ||||
| `expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime`, | `expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime`, | ||||
| `rent_shop_type` | |||||
| `rent_shop_type`,`return_price` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -69,7 +70,7 @@ | |||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | ||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType | |||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType,br.`return_price` returnPrice | |||||
| from wx_bill_rent_deposit br left join wx_merchant m on br.merchant_id=m.id | from wx_bill_rent_deposit br left join wx_merchant m on br.merchant_id=m.id | ||||
| left join wx_shop s on br.shop_id=s.id | left join wx_shop s on br.shop_id=s.id | ||||
| <where> | <where> | ||||
| @@ -80,6 +81,7 @@ | |||||
| <if test=" null != status ">and br.`status` = #{status}</if> | <if test=" null != status ">and br.`status` = #{status}</if> | ||||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | ||||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | |||||
| </where> | </where> | ||||
| order by id desc | order by id desc | ||||
| @@ -20,13 +20,14 @@ | |||||
| <result column="shop_id" jdbcType="INTEGER" property="shopId" /> | <result column="shop_id" jdbcType="INTEGER" property="shopId" /> | ||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | ||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="return_price" jdbcType="INTEGER" property="returnPrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`, | `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`, | ||||
| `pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type` | |||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`return_price` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -68,7 +69,7 @@ | |||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | ||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType | |||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType,br.`return_price` returnPrice | |||||
| from wx_bill_property_deposit br left join wx_merchant m on br.merchant_id=m.id | from wx_bill_property_deposit br left join wx_merchant m on br.merchant_id=m.id | ||||
| left join wx_shop s on br.shop_id=s.id | left join wx_shop s on br.shop_id=s.id | ||||
| <where> | <where> | ||||
| @@ -79,8 +80,7 @@ | |||||
| <if test=" null != status ">and br.`status` = #{status}</if> | <if test=" null != status ">and br.`status` = #{status}</if> | ||||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | ||||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | |||||
| </where> | </where> | ||||
| order by id desc | order by id desc | ||||
| </select> | </select> | ||||
| @@ -20,13 +20,21 @@ | |||||
| <result column="shop_id" jdbcType="INTEGER" property="shopId" /> | <result column="shop_id" jdbcType="INTEGER" property="shopId" /> | ||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | ||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="revenue" jdbcType="INTEGER" property="revenue"/> | |||||
| <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/> | |||||
| <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/> | |||||
| <result column="late_pay_price" jdbcType="INTEGER" property="latePayPrice"/> | |||||
| <result column="period" jdbcType="INTEGER" property="period"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | ||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type` | |||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | |||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -68,9 +76,14 @@ | |||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | ||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType | |||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType,br.`period`, | |||||
| br.`revenue`,br.`late_pay_ratio` latePayRatio,br.`late_pay_time` latePayTime, | |||||
| case when br.late_pay_time is null then 0 else | |||||
| FLOOR(DATEDIFF(now(),br.late_pay_time)*br.late_pay_ratio/10000*br.owe) end latePayPrice, | |||||
| (select max(period) from wx_bill_property where id=br.id) allPeriod,d.`status` depositStatus | |||||
| from wx_bill_property br left join wx_merchant m on br.merchant_id=m.id | from wx_bill_property br left join wx_merchant m on br.merchant_id=m.id | ||||
| left join wx_shop s on br.shop_id=s.id | left join wx_shop s on br.shop_id=s.id | ||||
| left join wx_bill_property_deposit d on br.property_contract_id=d.property_contract_id | |||||
| <where> | <where> | ||||
| <if test=" null != id ">and br.`id` = #{id}</if> | <if test=" null != id ">and br.`id` = #{id}</if> | ||||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | ||||
| @@ -20,14 +20,19 @@ | |||||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | ||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | ||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="revenue" jdbcType="INTEGER" property="revenue"/> | |||||
| <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/> | |||||
| <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/> | |||||
| <result column="late_pay_price" jdbcType="INTEGER" property="latePayPrice"/> | |||||
| <result column="period" jdbcType="INTEGER" property="period"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | ||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type` | |||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | |||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -72,9 +77,15 @@ | |||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | ||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType | |||||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType,r.type rentType,r.pay_ratio payRatio, | |||||
| br.`revenue`,br.`late_pay_ratio` latePayRatio,br.`late_pay_time` latePayTime,br.`period`, | |||||
| case when br.late_pay_time is null then 0 else | |||||
| FLOOR(DATEDIFF(now(),br.late_pay_time)*br.late_pay_ratio/10000*br.owe) end latePayPrice | |||||
| (select max(period) from wx_bill_rent where id=br.id) allPeriod,d.`status` depositStatus | |||||
| from wx_bill_rent br left join wx_merchant m on br.merchant_id=m.id | from wx_bill_rent br left join wx_merchant m on br.merchant_id=m.id | ||||
| left join wx_shop s on br.shop_id=s.id | left join wx_shop s on br.shop_id=s.id | ||||
| left join wx_rent_contract r on br.rent_contract_id=r.id | |||||
| left join wx_bill_rent_deposit d on br.rent_contract_id=d.rent_contract_id and br.merchant_id=d.merchant_id | |||||
| <where> | <where> | ||||
| <if test=" null != id ">and br.`id` = #{id}</if> | <if test=" null != id ">and br.`id` = #{id}</if> | ||||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | ||||