| @@ -5,6 +5,7 @@ import com.iformall.annotation.TenantIgnore; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumChartType; | import com.iformall.enums.EnumChartType; | ||||
| import com.iformall.service.WxChartDataService; | import com.iformall.service.WxChartDataService; | ||||
| @@ -73,13 +74,19 @@ public class WxChartDataController extends BaseController { | |||||
| @ApiImplicitParam(name = "startdate", value = "startdate", dataType = "String", paramType = "query"), | @ApiImplicitParam(name = "startdate", value = "startdate", dataType = "String", paramType = "query"), | ||||
| @ApiImplicitParam(name = "enddate", value = "enddate", dataType = "String", paramType = "query") | @ApiImplicitParam(name = "enddate", value = "enddate", dataType = "String", paramType = "query") | ||||
| }) | }) | ||||
| @SystemControllerLog(description = "报表-图表") | |||||
| public ResultData queryData(@RequestParam Map<String, String> params) { | public ResultData queryData(@RequestParam Map<String, String> params) { | ||||
| String chart = params.get("chart"); | String chart = params.get("chart"); | ||||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart); | logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| params.put("tenantId",tenantEntity.getTenantId()); | params.put("tenantId",tenantEntity.getTenantId()); | ||||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | params.put("parentTenantId", tenantEntity.getParentTenantId()); | ||||
| WxUserDataRule dr = this.getCurrentDataFloors(); | |||||
| if (null != dr) { | |||||
| params.put("floorRule", dr.getFloorForRule()); | |||||
| params.put("bussinessRule", dr.getBusinessForRule()); | |||||
| } | |||||
| ResultData data = wxChartDataService.queryData(params); | ResultData data = wxChartDataService.queryData(params); | ||||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart + " end"); | logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart + " end"); | ||||
| return data; | return data; | ||||
| @@ -88,7 +95,6 @@ public class WxChartDataController extends BaseController { | |||||
| @TenantIgnore | @TenantIgnore | ||||
| @GetMapping("queryWeekCount") | @GetMapping("queryWeekCount") | ||||
| @ApiOperation("查询用户增长 总数,今日,近一周") | @ApiOperation("查询用户增长 总数,今日,近一周") | ||||
| @SystemControllerLog(description = "会员首页-报表数据-查询用户增长") | |||||
| public ResultData queryWeekCount(Integer chartType) { | public ResultData queryWeekCount(Integer chartType) { | ||||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryWeekCount chartType: " + chartType); | logger.info("[" + getIpAddr() + "] WxChartDataController::queryWeekCount chartType: " + chartType); | ||||
| EnumChartType enumChartType = EnumChartType.getEnum(chartType); | EnumChartType enumChartType = EnumChartType.getEnum(chartType); | ||||
| @@ -101,7 +107,6 @@ public class WxChartDataController extends BaseController { | |||||
| @TenantIgnore | @TenantIgnore | ||||
| @GetMapping("queryMonthVos") | @GetMapping("queryMonthVos") | ||||
| @ApiOperation("查询用户增长 总数,今日,近一周") | @ApiOperation("查询用户增长 总数,今日,近一周") | ||||
| @SystemControllerLog(description = "会员首页-报表数据-查询用户增长") | |||||
| public ResultData queryMonthVos(Integer chartType) { | public ResultData queryMonthVos(Integer chartType) { | ||||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryMonthVos chartType: " + chartType); | logger.info("[" + getIpAddr() + "] WxChartDataController::queryMonthVos chartType: " + chartType); | ||||
| EnumChartType enumChartType = EnumChartType.getEnum(chartType); | EnumChartType enumChartType = EnumChartType.getEnum(chartType); | ||||
| @@ -91,8 +91,12 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| @GetMapping("/export") | @GetMapping("/export") | ||||
| @SystemControllerLog(description = "收银台-商户收银导出") | @SystemControllerLog(description = "收银台-商户收银导出") | ||||
| public void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response) { | public void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response) { | ||||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::exportMerchantMicroPay"); | |||||
| dto.updateTenantInfo(getTenantInfo()); | dto.updateTenantInfo(getTenantInfo()); | ||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| dto.setFloorForRule(dataRule.getFloorIds()); | |||||
| dto.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| markingDataReportService.exportMerchantMicroPay(dto, response); | markingDataReportService.exportMerchantMicroPay(dto, response); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.controller.rent; | package com.iformall.controller.rent; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| @@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -169,7 +171,9 @@ public class WxBillAllController extends BaseController { | |||||
| wxBillAll = new WxBillAll(); | wxBillAll = new WxBillAll(); | ||||
| } | } | ||||
| wxBillAll.updateTenantInfo(getTenantInfo()); | wxBillAll.updateTenantInfo(getTenantInfo()); | ||||
| Map<String, Object> result = wxBillAllService.getReceiveAndPayBillAsPage(wxBillAll, pageNum, pageSize); | |||||
| PageInfo<Map> page = wxBillAllService.getReceiveAndPayBillAsPage(wxBillAll, pageNum, pageSize); | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| result.put("pageInfo", page); | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } | } | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxBillRent; | import com.iformall.domain.po.WxBillRent; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.service.WxBillRentService; | import com.iformall.service.WxBillRentService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -41,6 +42,11 @@ public class WxBillRentController extends BaseController { | |||||
| wxBillRent = new WxBillRent(); | wxBillRent = new WxBillRent(); | ||||
| } | } | ||||
| wxBillRent.updateTenantInfo(getTenantInfo()); | wxBillRent.updateTenantInfo(getTenantInfo()); | ||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| wxBillRent.setFloorForRule(dataRule.getFloorIds()); | |||||
| wxBillRent.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| wxBillRent.setSortColumns(BaseEntity.SortField.Createtime_DESC,BaseEntity.SortField.Id_DESC); | wxBillRent.setSortColumns(BaseEntity.SortField.Createtime_DESC,BaseEntity.SortField.Id_DESC); | ||||
| final PageInfo<WxBillRent> page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize); | final PageInfo<WxBillRent> page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -7,6 +7,7 @@ import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| @@ -94,4 +95,6 @@ public class WxBillDeposit extends TenantEntity { | |||||
| private String serviceChargePayBefore; | private String serviceChargePayBefore; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String serviceChargePayUpdate; | private String serviceChargePayUpdate; | ||||
| @TableField(exist = false) | |||||
| private List<Long> rentContractIdList; | |||||
| } | } | ||||
| @@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils; | |||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| @@ -275,5 +276,11 @@ public class WxBillRent extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="楼层号",name="floor") | @io.swagger.annotations.ApiModelProperty(value="楼层号",name="floor") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long floor; | private Long floor; | ||||
| @TableField(exist = false) | |||||
| private List<Long> rentContractIdList; | |||||
| @TableField(exist = false) | |||||
| private List<Long> merchantIdList; | |||||
| } | } | ||||
| @@ -14,6 +14,7 @@ import java.util.Map; | |||||
| public interface WxBillDepositMapper extends CommonMapper<WxBillDeposit, Long> { | public interface WxBillDepositMapper extends CommonMapper<WxBillDeposit, Long> { | ||||
| List<WxBillDeposit> findList(WxBillDeposit wxBillDeposit); | List<WxBillDeposit> findList(WxBillDeposit wxBillDeposit); | ||||
| List<Long> findRentContractIds(WxBillDeposit wxBillDeposit); | |||||
| List<WxBillDeposit> queryBillDepositList(WxBillDeposit record); | List<WxBillDeposit> queryBillDepositList(WxBillDeposit record); | ||||
| @@ -17,6 +17,7 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> { | |||||
| List<WxBillRent> findList(WxBillRent wxBillRent); | List<WxBillRent> findList(WxBillRent wxBillRent); | ||||
| List<WxBillRent> queryBillRentList(WxBillRent record); | List<WxBillRent> queryBillRentList(WxBillRent record); | ||||
| List<Long> queryBillRentContractIdList(WxBillRent record); | |||||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | Map<String,Object> queryPayInfo(Map<String,Object> params); | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillSettle; | import com.iformall.domain.po.WxBillSettle; | ||||
| @@ -62,7 +63,7 @@ public interface WxBillAllService { | |||||
| * | * | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String, Object> getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); | |||||
| PageInfo<Map> getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); | |||||
| void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response); | void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response); | ||||
| @@ -648,6 +648,14 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| @Override | @Override | ||||
| public void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response) { | public void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response) { | ||||
| if (null != dto.getFloorForRule()) { | |||||
| List<Long> mids = wxMerchantService.getFloorBuildMerchantIds(dto, dto.getFloorForRule(), null, null, 0, 0); | |||||
| if (null == mids || mids.size() <= 0 ) { | |||||
| dto.setMerchantId(-1L); | |||||
| }else { | |||||
| dto.setMerchantIds(mids); | |||||
| } | |||||
| } | |||||
| List<PageMerchantMicroPayVO> vos = wxOrderMapper.listMerchantMicroPay(dto); | List<PageMerchantMicroPayVO> vos = wxOrderMapper.listMerchantMicroPay(dto); | ||||
| Map<Long, ListMerchantVO> merchantMap = wxMerchantService.listMerchant(dto, null).stream().collect(Collectors.toMap(ListMerchantVO::getId, Function.identity())); | Map<Long, ListMerchantVO> merchantMap = wxMerchantService.listMerchant(dto, null).stream().collect(Collectors.toMap(ListMerchantVO::getId, Function.identity())); | ||||
| @@ -2056,41 +2056,47 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| return result; | return result; | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, Object> getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| record.setLimitStart(0); | |||||
| record.setLimitEnd(Integer.MAX_VALUE); | |||||
| List totalList = wxBillAllMapper.getReceiveAndPayBillAsPage(record); | |||||
| if (CollectionUtils.isEmpty(totalList)) { | |||||
| PageHelper.startPage(pageNum, pageSize); | |||||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo(new ArrayList()); | |||||
| pageInfo.setPages(0); | |||||
| pageInfo.setTotal(0); | |||||
| PageHelper.clearPage(); | |||||
| result.put("pageInfo", pageInfo); | |||||
| return result; | |||||
| } | |||||
| int total = totalList.size(); | |||||
| int pages; | |||||
| if (total % pageSize == 0) { | |||||
| pages = total / pageSize; | |||||
| } else { | |||||
| pages = total / pageSize + 1; | |||||
| } | |||||
| record.setLimitStart((pageNum - 1) * pageSize); | |||||
| record.setLimitEnd(pageSize); | |||||
| List<Map<String, Object>> list = wxBillAllMapper.getReceiveAndPayBillAsPage(record); | |||||
| PageHelper.startPage(pageNum, pageSize); | |||||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo(list); | |||||
| pageInfo.setPages(pages); | |||||
| pageInfo.setTotal(total); | |||||
| PageHelper.clearPage(); | |||||
| result.put("pageInfo", pageInfo); | |||||
| return result; | |||||
| } | |||||
| // @Override | |||||
| // public Map<String, Object> getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { | |||||
| // Map<String, Object> result = new HashMap<>(); | |||||
| // record.setLimitStart(0); | |||||
| // record.setLimitEnd(Integer.MAX_VALUE); | |||||
| // List totalList = wxBillAllMapper.getReceiveAndPayBillAsPage(record); | |||||
| // if (CollectionUtils.isEmpty(totalList)) { | |||||
| // PageHelper.startPage(pageNum, pageSize); | |||||
| // PageInfo<Map<String, Object>> pageInfo = new PageInfo(new ArrayList()); | |||||
| // pageInfo.setPages(0); | |||||
| // pageInfo.setTotal(0); | |||||
| // PageHelper.clearPage(); | |||||
| // result.put("pageInfo", pageInfo); | |||||
| // return result; | |||||
| // } | |||||
| // | |||||
| // int total = totalList.size(); | |||||
| // int pages; | |||||
| // if (total % pageSize == 0) { | |||||
| // pages = total / pageSize; | |||||
| // } else { | |||||
| // pages = total / pageSize + 1; | |||||
| // } | |||||
| // record.setLimitStart((pageNum - 1) * pageSize); | |||||
| // record.setLimitEnd(pageSize); | |||||
| // List<Map<String, Object>> list = wxBillAllMapper.getReceiveAndPayBillAsPage(record); | |||||
| // | |||||
| // PageHelper.startPage(pageNum, pageSize); | |||||
| // PageInfo<Map<String, Object>> pageInfo = new PageInfo(list); | |||||
| // pageInfo.setPages(pages); | |||||
| // pageInfo.setTotal(total); | |||||
| // PageHelper.clearPage(); | |||||
| // result.put("pageInfo", pageInfo); | |||||
| // return result; | |||||
| // } | |||||
| @Override | |||||
| public PageInfo<Map> getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { | |||||
| PageInfo<Map> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getReceiveAndPayBillAsPage(record)); | |||||
| return pageInfo; | |||||
| } | |||||
| /** | /** | ||||
| * 使用java正则表达式去掉多余的.与0 | * 使用java正则表达式去掉多余的.与0 | ||||
| @@ -22,6 +22,7 @@ import org.joda.time.format.DateTimeFormatter; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -60,19 +61,15 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| WxBillDepositService wxBillDepositService; | WxBillDepositService wxBillDepositService; | ||||
| @Autowired | @Autowired | ||||
| WxBillRentManageMapper wxBillRentManageMapper; | WxBillRentManageMapper wxBillRentManageMapper; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxMerchantService wxMerchantService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | ||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | ||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record); | |||||
| billRentList.stream().forEach(e->{ | |||||
| //手续费 = 合同应收+手续费+滞纳金 | |||||
| computeTotalMoney(wxPayAccountBill, e); | |||||
| }); | |||||
| PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); | |||||
| return pageInfo; | |||||
| return getBillRentPropertyList(pageIndex,pageSize,record,wxPayAccountBill); | |||||
| } | } | ||||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRent rent) { | public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRent rent) { | ||||
| @@ -141,10 +138,11 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| public WxBillRent getById(Long id) { | public WxBillRent getById(Long id) { | ||||
| WxBillRent record = new WxBillRent(); | WxBillRent record = new WxBillRent(); | ||||
| record.setId(id); | record.setId(id); | ||||
| WxBillRent rent = wxBillRentMapper.queryBillRentList(record).get(0); | |||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | ||||
| PageInfo<WxBillRent> rp = getBillRentPropertyList(1,1,record,wxPayAccountBill); | |||||
| WxBillRent rent = rp.getList().get(0); | |||||
| //手续费 = 合同应收+手续费+滞纳金 | //手续费 = 合同应收+手续费+滞纳金 | ||||
| computeTotalMoney(wxPayAccountBill, rent); | |||||
| //computeTotalMoney(wxPayAccountBill, rent); | |||||
| rent.setOwe(rent.getRealReceivePay() - rent.getPay()); | rent.setOwe(rent.getRealReceivePay() - rent.getPay()); | ||||
| return rent; | return rent; | ||||
| } | } | ||||
| @@ -251,17 +249,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxBillRent> findByRentContractId(WxBillRent record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxBillRent> findByRentContractId(WxBillRent record, Integer pageIndex, Integer pageSize) { | ||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | ||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record); | |||||
| billRentList.stream().forEach(e->{ | |||||
| if(e.getPayRatio() == null){ | |||||
| e.setPayRatio(0l); | |||||
| } | |||||
| //手续费 = 合同应收+手续费+滞纳金 | |||||
| computeTotalMoney(wxPayAccountBill, e); | |||||
| }); | |||||
| PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); | |||||
| return pageInfo; | |||||
| return getBillRentPropertyList(pageIndex,pageSize,record,wxPayAccountBill); | |||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @@ -439,39 +427,125 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRent); | WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRent); | ||||
| String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; | String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; | ||||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); | |||||
| billRentList.stream().forEach(e->{ | |||||
| //手续费 = 合同应收+手续费+滞纳金 | |||||
| computeTotalMoney(wxPayAccountBill, e); | |||||
| }); | |||||
| Map<Long, List<WxBillRent>> collect = billRentList.parallelStream() | |||||
| .collect(Collectors.groupingBy(WxBillRent::getMerchantId)); | |||||
| Set<Map.Entry<Long, List<WxBillRent>>> entries = collect.entrySet(); | |||||
| PageInfo<WxBillRent> billRentList = getBillRentPropertyList(1,10000,wxBillRent,wxPayAccountBill); | |||||
| List<WxBillRent> datalist = new ArrayList<>(); | List<WxBillRent> datalist = new ArrayList<>(); | ||||
| for (Map.Entry<Long, List<WxBillRent>> entry : entries) { | |||||
| List<WxBillRent> list = entry.getValue(); | |||||
| for (WxBillRent rent : list) { | |||||
| if (rent.getDepositStatus() == null) { | |||||
| rent.setDepositStatus(0); | |||||
| } | |||||
| String shopNumber = rent.getShopNumber(); | |||||
| if (StringUtils.isEmpty(shopNumber)) { | |||||
| String shopInfo = rent.getShopInfo(); | |||||
| if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { | |||||
| JSONObject jsonObject = JSONObject.parseObject(shopInfo); | |||||
| StringBuffer sb = new StringBuffer(); | |||||
| Set<Map.Entry<String, Object>> sets = jsonObject.entrySet(); | |||||
| sets.forEach(x -> sb.append(x.getKey()).append(",")); | |||||
| if(StringUtils.isNotBlank(sb)){ | |||||
| rent.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); | |||||
| if (null != billRentList && null != billRentList.getList()) { | |||||
| Map<Long, List<WxBillRent>> collect = billRentList.getList().parallelStream() | |||||
| .collect(Collectors.groupingBy(WxBillRent::getMerchantId)); | |||||
| Set<Map.Entry<Long, List<WxBillRent>>> entries = collect.entrySet(); | |||||
| for (Map.Entry<Long, List<WxBillRent>> entry : entries) { | |||||
| List<WxBillRent> list = entry.getValue(); | |||||
| for (WxBillRent rent : list) { | |||||
| if (rent.getDepositStatus() == null) { | |||||
| rent.setDepositStatus(0); | |||||
| } | |||||
| String shopNumber = rent.getShopNumber(); | |||||
| if (StringUtils.isEmpty(shopNumber)) { | |||||
| String shopInfo = rent.getShopInfo(); | |||||
| if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { | |||||
| JSONObject jsonObject = JSONObject.parseObject(shopInfo); | |||||
| StringBuffer sb = new StringBuffer(); | |||||
| Set<Map.Entry<String, Object>> sets = jsonObject.entrySet(); | |||||
| sets.forEach(x -> sb.append(x.getKey()).append(",")); | |||||
| if(StringUtils.isNotBlank(sb)){ | |||||
| rent.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| datalist.add(rent); | |||||
| } | } | ||||
| datalist.add(rent); | |||||
| } | } | ||||
| } | } | ||||
| excelService.exportExcel(datalist, null, billName, WxBillRent.class, billName + ".xlsx", response, false); | excelService.exportExcel(datalist, null, billName, WxBillRent.class, billName + ".xlsx", response, false); | ||||
| } | } | ||||
| private PageInfo<WxBillRent> getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillRent wxBillRent,WxPayAccountBill wxPayAccountBill) { | |||||
| if(null != wxBillRent.getDepositStatus()) { | |||||
| WxBillDeposit bdq1 = new WxBillDeposit(); | |||||
| bdq1.updateTenantInfo(wxBillRent); | |||||
| bdq1.setStatus(wxBillRent.getDepositStatus()); | |||||
| List<Long> rentids = wxBillDepositMapper.findRentContractIds(bdq1); | |||||
| if (null != rentids && rentids.size() > 0 ) { | |||||
| wxBillRent.setRentContractIdList(rentids); | |||||
| }else { | |||||
| wxBillRent.setId(-1L); | |||||
| } | |||||
| } | |||||
| if (null != wxBillRent.getFloor() || null != wxBillRent.getBuilding()) { | |||||
| List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRent, null, wxBillRent.getBuilding(), wxBillRent.getFloor(), 0, 0); | |||||
| if (null != merchantIds) { | |||||
| wxBillRent.setMerchantIdList(merchantIds); | |||||
| }else { | |||||
| wxBillRent.setId(-1L); | |||||
| } | |||||
| } | |||||
| PageInfo<WxBillRent> billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentMapper.queryBillRentList(wxBillRent)); | |||||
| if (null == billRentList) { | |||||
| return null; | |||||
| } | |||||
| List<Long> rentContractIdList = wxBillRentMapper.queryBillRentContractIdList(wxBillRent); | |||||
| Map<Long,WxRentContract> rentContractMap = new HashMap<Long,WxRentContract>(); | |||||
| Map<Long,WxBillDeposit> billDepositMap = new HashMap<Long,WxBillDeposit>(); | |||||
| if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { | |||||
| WxRentContract rcq = new WxRentContract(); | |||||
| rcq.updateTenantInfo(wxBillRent); | |||||
| rcq.setIds(rentContractIdList); | |||||
| List<WxRentContract> rlist = wxRentContractMapper.findList(rcq); | |||||
| if (null != rlist && rlist.size() > 0 ) { | |||||
| for (int i = 0 ; i < rlist.size(); i++) { | |||||
| WxRentContract rc = rlist.get(i); | |||||
| rentContractMap.put(rc.getId(), rc); | |||||
| } | |||||
| } | |||||
| WxBillDeposit bdq = new WxBillDeposit(); | |||||
| bdq.updateTenantInfo(wxBillRent); | |||||
| bdq.setRentContractIdList(rentContractIdList); | |||||
| List<WxBillDeposit> bdlist = wxBillDepositMapper.findList(bdq); | |||||
| if (null != bdlist && bdlist.size() > 0 ) { | |||||
| for (int i = 0 ; i < bdlist.size(); i++) { | |||||
| WxBillDeposit rc = bdlist.get(i); | |||||
| billDepositMap.put(rc.getId(), rc); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (null != billRentList.getList()) { | |||||
| billRentList.getList().stream().forEach(e->{ | |||||
| if(e.getPayRatio() == null){ | |||||
| e.setPayRatio(0l); | |||||
| } | |||||
| //手续费 = 合同应收+手续费+滞纳金 | |||||
| computeTotalMoney(wxPayAccountBill, e); | |||||
| WxRentContract rent = rentContractMap.get(e.getRentContractId()); | |||||
| if (null != rent) { | |||||
| e.setMerchantName(rent.getMerchantName()); | |||||
| e.setRentType(rent.getType()); | |||||
| if (null != rent.getPayRatio()) { | |||||
| e.setPayRatio(rent.getPayRatio().longValue()); | |||||
| } | |||||
| if (null != rent.getLatePayRatio()) { | |||||
| e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); | |||||
| } | |||||
| e.setLatePayDay(rent.getLatePayDay()); | |||||
| if (null != rent.getLatePayRatio()) { | |||||
| e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); | |||||
| } | |||||
| } | |||||
| WxBillDeposit bd = billDepositMap.get(e.getRentContractId()); | |||||
| if (null != bd) { | |||||
| e.setDeposit(bd.getReceivePay()); | |||||
| e.setDepositStatus(bd.getStatus()); | |||||
| } | |||||
| }); | |||||
| } | |||||
| return billRentList; | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData updateLatePayMoney(WxBillRent record, MallUserInfo user) { | public ResultData updateLatePayMoney(WxBillRent record, MallUserInfo user) { | ||||
| @@ -261,6 +261,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| tenantEntity.setTenantId(tenantId); | tenantEntity.setTenantId(tenantId); | ||||
| tenantEntity.setParentTenantId(parentTenantId); | tenantEntity.setParentTenantId(parentTenantId); | ||||
| //String floorRule = paramsMap.get("floorRule"); | |||||
| //String bussinessRule = paramsMap.get("bussinessRule"); | |||||
| //出租率 | //出租率 | ||||
| if (chart.equals(EnumChart.CZL.getCode())) { | if (chart.equals(EnumChart.CZL.getCode())) { | ||||
| return getRentRate(tenantEntity); | return getRentRate(tenantEntity); | ||||
| @@ -67,6 +67,12 @@ | |||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | ||||
| <if test=" null != rentContractIdList "> | |||||
| and rent_contract_id in | |||||
| <foreach collection="rentContractIdList" index="index" item="rdItem" open="(" separator="," close=")"> | |||||
| #{rdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -81,6 +87,11 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findRentContractIds" parameterType="com.iformall.domain.po.WxBillDeposit" resultType="Long"> | |||||
| select distinct rent_contract_id from wx_bill_rent_deposit | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap"> | <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap"> | ||||
| select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, | select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, | ||||
| br.`owe`,br.`status`,br.`need_pay`,m.`name` merchant_name,s.shop_number,br.`updatetime`,br.`merchant_id`, | br.`owe`,br.`status`,br.`need_pay`,m.`name` merchant_name,s.shop_number,br.`updatetime`,br.`merchant_id`, | ||||
| @@ -118,25 +118,14 @@ | |||||
| from wx_bill_rent | from wx_bill_rent | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </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.`contract_need_pay`,br.`rent_price_info`,br.`need_pay`,br.`bussiness_manage_fee_need_pay`,br.`operating_manage_fee_need_pay`, | |||||
| r.merchant_name,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`, | |||||
| r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | |||||
| d.receive_pay deposit,d.`status` | |||||
| deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, | |||||
| r.late_pay_day,r.late_pay_ratio,br.bus_discount_ratio,br.freeze,br.join_rent_price,br.service_charge_pay | |||||
| from wx_bill_rent br | |||||
| 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> | |||||
| <sql id="queryBillRentListCondition"> | |||||
| <where> | |||||
| br.is_preview = 0 | br.is_preview = 0 | ||||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | <if test=" null != freeze ">and br.`freeze` = #{freeze}</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 != status ">and br.`status` = #{status}</if> | <if test=" null != status ">and br.`status` = #{status}</if> | ||||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | ||||
| <if test=" null != depositStatus ">and d.`status` = #{depositStatus}</if> | |||||
| <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> | ||||
| <if test=" null != merchantName and ''!=merchantName ">and r.merchant_name like | <if test=" null != merchantName and ''!=merchantName ">and r.merchant_name like | ||||
| @@ -148,28 +137,38 @@ | |||||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | ||||
| <if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime} | <if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime} | ||||
| </if> | </if> | ||||
| <if test=" null != building or null != floor"> | |||||
| and br.`merchant_id` in( | |||||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||||
| inner join wx_merchant m on ms.merchant_id = m.id | |||||
| inner join wx_shop s on s.id=ms.shop_id | |||||
| where s.is_del=0 | |||||
| <if test=" null != building "> | |||||
| and s.`building`= #{building} | |||||
| </if> | |||||
| <if test=" null != floor"> | |||||
| and s.`floor` = #{floor} | |||||
| </if> | |||||
| ) | |||||
| <if test=" null != rentContractIdList "> | |||||
| and br.`rent_contract_id` in | |||||
| <foreach collection="rentContractIdList" index="index" item="ridItem" open="(" separator="," close=")"> | |||||
| #{ridItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != merchantIdList "> | |||||
| and br.`merchant_id` in | |||||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||||
| #{midItem} | |||||
| </foreach> | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <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.`contract_need_pay`,br.`rent_price_info`,br.`need_pay`,br.`bussiness_manage_fee_need_pay`,br.`operating_manage_fee_need_pay`, | |||||
| br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.`revenue`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | |||||
| br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime,br.bus_discount_ratio,br.freeze,br.join_rent_price,br.service_charge_pay | |||||
| from wx_bill_rent br | |||||
| <include refid="queryBillRentListCondition"/> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| <if test="null != limitStart and null != limitEnd"> | <if test="null != limitStart and null != limitEnd"> | ||||
| limit #{limitStart},#{limitEnd} | limit #{limitStart},#{limitEnd} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="queryBillRentContractIdList" parameterType="com.iformall.domain.po.WxBillRent" resultType="Long"> | |||||
| select distinct rent_contract_id from wx_bill_rent br | |||||
| <include refid="queryBillRentListCondition"/> | |||||
| </select> | |||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | ||||