| @@ -4,9 +4,9 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.BaseEntity; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumBillTypeParam; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -21,6 +21,12 @@ import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -33,6 +39,14 @@ public class WxBillActionController extends BaseController { | |||
| @Autowired | |||
| private WxBillActionService wxBillActionService; | |||
| @Autowired | |||
| private WxRentContractService wxRentContractService; | |||
| @Autowired | |||
| private WxPropertyContractService wxPropertyContractService; | |||
| @Autowired | |||
| private WxBillRentService wxBillRentService; | |||
| @Autowired | |||
| private WxBillPropertyService wxBillPropertyService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -50,24 +64,60 @@ public class WxBillActionController extends BaseController { | |||
| return new ResultData(result); | |||
| } | |||
| public void addSysLatePayBillAction(WxBillAction wxBillAction){ | |||
| } | |||
| @ApiOperation("滞纳金变更列表") | |||
| @GetMapping("latePaylist") | |||
| @SystemControllerLog(description = "账单操作记录-滞纳金列表") | |||
| public ResultData latePaylist(@ModelAttribute WxBillAction wxBillAction, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillActionController::latePaylist"); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| if (null == wxBillAction) { | |||
| wxBillAction = new WxBillAction(); | |||
| } | |||
| Date frontDay = DateUtils.getDaySet(new Date(), Calendar.DATE,-1); | |||
| wxBillAction.setBillId(wxBillAction.getBillId()); | |||
| wxBillAction.setStartDate(sdf.format(frontDay)); | |||
| wxBillAction.setEndDate(sdf.format(frontDay)+" 23:59:59"); | |||
| List<WxBillAction> billActionList = wxBillActionService.find(wxBillAction); | |||
| if(CollectionUtils.isEmpty(billActionList)){ | |||
| } | |||
| wxBillAction.setTenantId(getTenantId()); | |||
| wxBillAction.setSortColumns(BaseEntity.SortField.Id_DESC); | |||
| PageInfo<WxBillAction> result = wxBillActionService.listAsPage(wxBillAction, pageNum, pageSize); | |||
| if(result != null && CollectionUtils.isNotEmpty(result.getList())){ | |||
| // DateUtils.getDaySet() | |||
| // for (WxBillAction action:result.getList()) { | |||
| // | |||
| // } | |||
| Date startDate; | |||
| Date endDate = DateUtils.getDaySet(new Date(), Calendar.DATE,-1);; | |||
| if (EnumBillTypeParam.RENT.getCode().equals(result.getList().get(0).getBillType())) { | |||
| WxBillRent billRent = new WxBillRent(); | |||
| billRent.setId(wxBillAction.getBillId()); | |||
| WxRentContract rentContract = wxRentContractService.getByBill(billRent); | |||
| WxBillRent wxBillRent = wxBillRentService.getById(wxBillAction.getBillId()); | |||
| startDate = DateUtils.getDaySet(wxBillRent.getReceiveDate(), Calendar.DATE,rentContract.getLatePayDay()); | |||
| }else if (EnumBillTypeParam.PROPERTY.getCode().equals(result.getList().get(0).getBillType())) { | |||
| WxBillProperty billRent = new WxBillProperty(); | |||
| billRent.setId(wxBillAction.getBillId()); | |||
| WxPropertyContract propertyContract = wxPropertyContractService.getByBill(billRent); | |||
| WxBillProperty wxBillProperty = wxBillPropertyService.getById(wxBillAction.getBillId()); | |||
| startDate = DateUtils.getDaySet(wxBillProperty.getReceiveDate(), Calendar.DATE,propertyContract.getLatePayDay()); | |||
| } | |||
| Date curr = endDate; | |||
| for (WxBillAction action:result.getList()) { | |||
| if(sdf.format(curr).equals(action.getCreatetime())){ | |||
| continue; | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(result); | |||
| } | |||
| } | |||
| @@ -54,10 +54,18 @@ public class WxBillAction extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "付款时间", name = "payDate") | |||
| private Date payDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "账单类型", name = "billType") | |||
| private Integer billType; | |||
| @Transient | |||
| private Long oldPrice; | |||
| @Transient | |||
| private Long newPrice; | |||
| @Transient | |||
| private String startDate; | |||
| @Transient | |||
| private String endDate; | |||
| } | |||
| @@ -168,4 +168,12 @@ public class WxBillProperty extends BaseEntity { | |||
| @Transient | |||
| private Long deposit; | |||
| @Transient | |||
| private Integer limitStart; | |||
| @Transient | |||
| private Integer limitEnd; | |||
| @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") | |||
| @Transient | |||
| private Integer latePayDay; | |||
| } | |||
| @@ -179,5 +179,15 @@ public class WxBillRent extends BaseEntity { | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营费率", name = "payRatio") | |||
| private Long payRatio; | |||
| @Transient | |||
| private Integer limitStart; | |||
| @Transient | |||
| private Integer limitEnd; | |||
| @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") | |||
| @Transient | |||
| private Integer latePayDay; | |||
| } | |||
| @@ -141,11 +141,11 @@ public class WxPropertyContract extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") | |||
| private String adjustRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayDay") | |||
| private String latePayDay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") | |||
| private String latePayRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") | |||
| private Integer latePayRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayDay") | |||
| private Integer latePayDay; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "物业预账单列表", name = "previewBillRentList") | |||
| @@ -13,4 +13,5 @@ public interface WxBillActionMapper extends CommonMapper<WxBillAction, Long> { | |||
| List<WxShop> findList(WxBillAction wxBillAction); | |||
| List<WxBillAction> findBillActionList(WxBillAction wxBillAction); | |||
| } | |||
| @@ -1,6 +1,8 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| @@ -47,4 +49,6 @@ public interface WxPropertyContractMapper extends CommonMapper<WxPropertyContrac | |||
| void updateStatusByRentContractId(WxPropertyContract wxPropertyContract); | |||
| WxPropertyContract findOneByRentId(WxRentContract wxRentContract); | |||
| WxPropertyContract getByBill(WxBillProperty billRent); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.vo.WxRentPropertyContractVo; | |||
| @@ -62,4 +63,5 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record); | |||
| WxRentContract getByBill(WxBillRent billRent); | |||
| } | |||
| @@ -4,6 +4,8 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -15,4 +17,5 @@ public interface WxBillActionService { | |||
| int modifyBill(WxBillAction wxBillAction, MallUserInfo mallUserInfo); | |||
| List<WxBillAction> find(WxBillAction record); | |||
| } | |||
| @@ -58,7 +58,7 @@ public interface WxBillAllService { | |||
| ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user); | |||
| void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); | |||
| void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo,Integer billType); | |||
| void exportTemplate(WxBillExcelTemplate wxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response); | |||
| @@ -73,4 +73,6 @@ public interface WxPropertyContractService { | |||
| Map<String, Object> updateStatus(WxPropertyContract record); | |||
| List<WxBillProperty> buildProperty(WxMerchant wxMerchant, Long userId, WxPropertyContract propertyContract, Integer isPreview,boolean saveDb); | |||
| WxPropertyContract getByBill(WxBillProperty billRent); | |||
| } | |||
| @@ -2,9 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxRentPropertyContractVo; | |||
| import io.swagger.models.auth.In; | |||
| @@ -94,4 +92,6 @@ public interface WxRentContractService { | |||
| Map<String, Object> updateStatus(WxRentContract record); | |||
| WxRentContract getByBill(WxBillRent billRent); | |||
| } | |||
| @@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| @@ -24,6 +25,11 @@ public class WxBillActionServiceImpl implements WxBillActionService { | |||
| @Autowired | |||
| WxBillActionMapper wxBillActionMapper; | |||
| @Override | |||
| public List<WxBillAction> find(WxBillAction record) { | |||
| return wxBillActionMapper.findBillActionList(record); | |||
| } | |||
| @Override | |||
| public PageInfo<WxBillAction> listAsPage(WxBillAction record, Integer pageIndex, Integer pageSize) { | |||
| logger.info("查询账单操作记录列表"); | |||
| @@ -57,6 +63,7 @@ public class WxBillActionServiceImpl implements WxBillActionService { | |||
| Date date = new Date(); | |||
| wxBillAction.setCreatetime(date); | |||
| wxBillAction.setUpdatetime(date); | |||
| wxBillAction.setBillType(action.getBillType()); | |||
| return wxBillActionMapper.insertSelective(wxBillAction); | |||
| } | |||
| @@ -784,7 +784,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| if(oldLatePrice != null){ | |||
| wxBillRent.setLatePayPrice(newLatePrice); | |||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY,id, oldPrice, newPrice, user); | |||
| addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY,id, oldPrice, newPrice, user,billType); | |||
| }else{ | |||
| //租赁账单更新 | |||
| wxBillRent.setReceivePay(newPrice); | |||
| @@ -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,billType); | |||
| } | |||
| } else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { | |||
| WxBillDeposit dbBill = wxBillDepositMapper.selectByPrimaryKey(id); | |||
| @@ -809,7 +809,7 @@ 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,billType); | |||
| } else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { | |||
| WxBillProperty dbBill = wxBillPropertyMapper.selectByPrimaryKey(id); | |||
| //物业账单更新 | |||
| @@ -819,7 +819,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| if(oldLatePrice != null){ | |||
| wxBillProperty.setLatePayPrice(newLatePrice); | |||
| wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillProperty); | |||
| addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY,id, oldPrice, newPrice, user); | |||
| addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY,id, oldPrice, newPrice, user,billType); | |||
| }else{ | |||
| wxBillProperty.setReceivePay(newPrice); | |||
| wxBillProperty.setOwe(newPrice - 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,billType); | |||
| } | |||
| } 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,billType); | |||
| } 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,billType); | |||
| } 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,billType); | |||
| } 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,billType); | |||
| } 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,billType); | |||
| } 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,billType); | |||
| } else { | |||
| logger.info("未找到账单类型"); | |||
| } | |||
| @@ -894,13 +894,14 @@ 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,Integer billType) { | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(billId); | |||
| String oldPriceStr = new BigDecimal(oldPrice).divide(new BigDecimal(100)).toPlainString(); | |||
| String newPriceStr = new BigDecimal(newPrice).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails(oldPriceStr + "元变更成" + newPriceStr + "元"); | |||
| wxBillAction.setAction(billAction.getCode()); | |||
| wxBillAction.setBillType(billType); | |||
| wxBillActionService.modifyBill(wxBillAction, mallUserInfo); | |||
| } | |||
| @@ -53,6 +53,18 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); | |||
| billRentList.stream().forEach(b -> { | |||
| if(EnumBillRentStatus.WAIT_PAY.getCode().equals(b.getLatePayStatus()) && b.getLatePayRatio() != null){ | |||
| int latePayDay = 1; //默认第二天开始叫滞纳金 | |||
| if(b.getLatePayDay() != null){ | |||
| latePayDay = b.getLatePayDay(); | |||
| } | |||
| Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay); | |||
| long dayCount = DateUtils.startToEnd(new Date(),startPay); | |||
| Double d = new Double(dayCount * b.getLatePayRatio()/10000 * b.getOwe()); | |||
| b.setLatePayPrice(d.longValue()); | |||
| } | |||
| }); | |||
| return pageInfo; | |||
| } | |||
| @@ -52,6 +52,18 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record); | |||
| billRentList.stream().forEach(b -> { | |||
| if(EnumBillRentStatus.WAIT_PAY.getCode().equals(b.getLatePayStatus()) && b.getLatePayRatio() != null){ | |||
| int latePayDay = 1; //默认第二天开始叫滞纳金 | |||
| if(b.getLatePayDay() != null){ | |||
| latePayDay = b.getLatePayDay(); | |||
| } | |||
| Date startPay = DateUtils.getDaySet(b.getReceiveDate(),Calendar.DATE,latePayDay); | |||
| long dayCount = DateUtils.startToEnd(new Date(),startPay); | |||
| Double d = new Double(dayCount * b.getLatePayRatio()/10000 * b.getOwe()); | |||
| b.setLatePayPrice(d.longValue()); | |||
| } | |||
| }); | |||
| PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| } | |||
| @@ -1094,6 +1094,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| wxBillProperty.setPropertyContractId(wxPropertyContract.getId()); | |||
| wxBillPropertyMapper.updateInvalidStatus(wxBillProperty); | |||
| } | |||
| @Override | |||
| public WxPropertyContract getByBill(WxBillProperty billRent) { | |||
| return wxPropertyContractMapper.getByBill(billRent); | |||
| } | |||
| } | |||
| @@ -2205,4 +2205,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxMerchantService.disable(rentContract.getMerchantId()); | |||
| } | |||
| } | |||
| @Override | |||
| public WxRentContract getByBill(WxBillRent billRent) { | |||
| return wxRentContractMapper.getByBill(billRent); | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ import java.time.LocalDate; | |||
| import java.time.LocalDateTime; | |||
| import java.time.Period; | |||
| import java.time.ZoneId; | |||
| import java.time.temporal.ChronoUnit; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| @@ -1198,6 +1199,26 @@ public class DateUtils { | |||
| return calendar.getTime(); | |||
| } | |||
| /** | |||
| * 计算两个日期之间的间隔天数 | |||
| * @param startDate | |||
| * @param endDate | |||
| * @return | |||
| */ | |||
| public static long startToEnd(Date startDate, Date endDate){ | |||
| String[] startStr = new SimpleDateFormat("yyyy-MM-dd").format(startDate).split("-"); | |||
| String[] endStr = new SimpleDateFormat("yyyy-MM-dd").format(endDate).split("-"); | |||
| Integer startYear = Integer.parseInt(startStr[0]); | |||
| Integer startMonth = Integer.parseInt(startStr[1]); | |||
| Integer startDay = Integer.parseInt(startStr[2]); | |||
| Integer endYear = Integer.parseInt(endStr[0]); | |||
| Integer endMonth = Integer.parseInt(endStr[1]); | |||
| Integer endDay = Integer.parseInt(endStr[2]); | |||
| LocalDate endLocalDate = LocalDate.of(endYear,endMonth,endDay); | |||
| LocalDate startLocalDate = LocalDate.of(startYear,startMonth,startDay); | |||
| return startLocalDate.until(endLocalDate, ChronoUnit.DAYS); | |||
| } | |||
| public static void main(String[] args) { | |||
| Date curDate = new Date(); | |||
| Date limitDate = DateUtils.getTimeAfterDays(7, curDate); | |||
| @@ -13,10 +13,11 @@ | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="bill_type" property="billType"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`bill_id`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime`,`pay_date` | |||
| `id`,`tenant_id`,`bill_id`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime`,`pay_date`,bill_type | |||
| </sql> | |||
| @@ -34,6 +35,10 @@ | |||
| <if test=" null != billId "> | |||
| and `bill_id` = #{billId} | |||
| </if> | |||
| <if test=" null != startDate and null != endDate"> | |||
| and `createtime` BETWEEN startDate and endDate | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -51,5 +56,12 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findBillActionList" parameterType="com.iformall.domain.po.WxBillAction" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_action | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -37,7 +37,9 @@ | |||
| <result column="deposit" property="deposit"/> | |||
| <result column="deposit_status" property="depositStatus"/> | |||
| <result column="all_period" property="allPeriod"/> | |||
| <result column="late_pay_day" property="latePayDay"/> | |||
| <result column="late_pay_ratio" property="latePayRatio"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -91,11 +93,10 @@ | |||
| case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,m.`name` | |||
| merchant_name,s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`, | |||
| br.`revenue`,br.`late_pay_ratio`,br.`late_pay_time`,br.`property_contract_id`,d.receive_pay deposit, | |||
| case when br.late_pay_status=2 then (case when br.late_pay_time is null then 0 | |||
| else FLOOR(DATEDIFF(now(),date_add(br.receive_date,interval r.late_pay_day day))*r.late_pay_ratio/10000*br.owe)end) | |||
| else br.late_pay_price end late_pay_price,d.`status` | |||
| br.late_pay_price,d.`status` | |||
| deposit_status,br.`shop_info`,br.pay_way,br.late_pay_status, | |||
| br.`comments`,br.starttime,br.endtime | |||
| br.`comments`,br.starttime,br.endtime, | |||
| r.late_pay_day,r.late_pay_ratio | |||
| 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_property_contract r on br.property_contract_id=r.id | |||
| @@ -38,10 +38,10 @@ | |||
| <result column="deposit_status" property="depositStatus"/> | |||
| <result column="rent_type" property="rentType"/> | |||
| <result column="all_period" property="allPeriod"/> | |||
| <result column="pay_ratio" property="payRatio"/> | |||
| <result column="late_pay_day" property="latePayDay"/> | |||
| <result column="late_pay_ratio" property="latePayRatio"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -91,19 +91,15 @@ | |||
| from wx_bill_rent | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="queryBillRentList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, | |||
| case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name, | |||
| s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type, | |||
| r.pay_ratio,br.`revenue`,br.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | |||
| d.receive_pay deposit, | |||
| case when br.late_pay_status=2 then (case when br.late_pay_time is null then 0 | |||
| else FLOOR(DATEDIFF(now(),date_add(br.receive_date,interval r.late_pay_day day))*r.late_pay_ratio/10000*br.owe)end) | |||
| else br.late_pay_price end | |||
| late_pay_price,d.`status` | |||
| deposit_status,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime | |||
| d.receive_pay deposit,d.`status`,br.late_pay_price | |||
| deposit_status,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, | |||
| r.late_pay_day,r.late_pay_ratio | |||
| from wx_bill_rent br | |||
| left join wx_shop s on br.shop_id=s.id | |||
| left join wx_rent_contract r on br.rent_contract_id=r.id | |||
| @@ -126,6 +122,10 @@ | |||
| </if> | |||
| </where> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test="null != limitStart and null != limitEnd"> | |||
| limit #{limitStart},#{limitEnd} | |||
| </if> | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| @@ -240,4 +240,10 @@ | |||
| <select id="findOneByRentId" parameterType="com.iformall.domain.po.WxRentContract" resultType="com.iformall.domain.po.WxPropertyContract"> | |||
| select * from wx_property_contract where rent_contract_id =#{id} order by createtime desc limit 1 | |||
| </select> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap"> | |||
| select * from wx_property_contract where id in( | |||
| select property_contract_id from wx_bill_property id = #{id} | |||
| ) | |||
| </select> | |||
| </mapper> | |||
| @@ -351,5 +351,9 @@ | |||
| <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if> | |||
| </select> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| select * from wx_rent_contract where id in( | |||
| select rent_contract_id from wx_bill_rent id = #{id} | |||
| ) | |||
| </select> | |||
| </mapper> | |||