| @@ -5,10 +5,29 @@ 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; | ||||
| import com.iformall.domain.po.WxBillDaily; | |||||
| import com.iformall.domain.po.WxBillDeposit; | |||||
| import com.iformall.domain.po.WxBillOther; | |||||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||||
| import com.iformall.domain.po.WxBillProperty; | |||||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||||
| import com.iformall.domain.po.WxBillRent; | |||||
| import com.iformall.domain.po.WxBillRentManage; | |||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.domain.vo.WxBillExcelTemplate; | import com.iformall.domain.vo.WxBillExcelTemplate; | ||||
| import com.iformall.domain.vo.WxBillSum; | |||||
| import com.iformall.domain.vo.WxMerchantBillVo; | |||||
| import com.iformall.service.WxBillAllService; | import com.iformall.service.WxBillAllService; | ||||
| import com.iformall.service.WxBillDailyService; | |||||
| import com.iformall.service.WxBillDepositService; | |||||
| import com.iformall.service.WxBillOtherDepositService; | |||||
| import com.iformall.service.WxBillOtherService; | |||||
| import com.iformall.service.WxBillPropertyDepositService; | |||||
| import com.iformall.service.WxBillPropertyService; | |||||
| import com.iformall.service.WxBillRentManageService; | |||||
| import com.iformall.service.WxBillRentService; | |||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxPayAccountBillService; | import com.iformall.service.WxPayAccountBillService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -22,8 +41,12 @@ 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.math.BigDecimal; | |||||
| import java.math.RoundingMode; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -37,11 +60,135 @@ public class WxBillAllController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantService wxMerchantService; | private WxMerchantService wxMerchantService; | ||||
| @Autowired | |||||
| private WxBillRentService wxBillRentService; | |||||
| @Autowired | |||||
| private WxBillRentManageService wxBillRentManageService; | |||||
| @Autowired | |||||
| private WxBillDepositService wxBillRentDepositService; | |||||
| @Autowired | |||||
| private WxBillPropertyService wxBillPropertyService; | |||||
| @Autowired | |||||
| private WxBillPropertyDepositService wxBillPropertyDepositService; | |||||
| @Autowired | |||||
| private WxBillDailyService wxBillDailyService; | |||||
| @Autowired | |||||
| private WxBillOtherService wxBillOtherService; | |||||
| @Autowired | |||||
| private WxBillOtherDepositService wxBillOtherDepositService; | |||||
| private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | ||||
| @Autowired | @Autowired | ||||
| WxPayAccountBillService wxPayAccountBillService; | WxPayAccountBillService wxPayAccountBillService; | ||||
| @GetMapping("merchantBillList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData merchantBillList(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| wxMerchant.setFloorForRule(dataRule.getFloorIds()); | |||||
| wxMerchant.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| PageInfo<WxMerchant> merchantPage = wxMerchantService.listAsPage(wxMerchant, pageNum, pageSize); | |||||
| if (null != merchantPage && null != merchantPage.getList() && merchantPage.getList().size() > 0 ) { | |||||
| List<WxMerchantBillVo> retList = new ArrayList<WxMerchantBillVo>(); | |||||
| for (int i = 0 ; i < merchantPage.getList().size(); i ++) { | |||||
| WxMerchantBillVo vo = new WxMerchantBillVo(); | |||||
| WxMerchant m = merchantPage.getList().get(i); | |||||
| vo.setMerchantId(m.getId()); | |||||
| vo.setMerchantName(m.getName()); | |||||
| WxBillRent br = new WxBillRent(); | |||||
| br.updateTenantInfo(wxMerchant); | |||||
| br.setStarttime(wxMerchant.getStarttime()); | |||||
| br.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum rentSum = wxBillRentService.getBillMonthSum(br); | |||||
| WxBillRentManage brm = new WxBillRentManage(); | |||||
| brm.updateTenantInfo(wxMerchant); | |||||
| brm.setStarttime(wxMerchant.getStarttime()); | |||||
| brm.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum rentManageSum = wxBillRentManageService.getBillMonthSum(brm); | |||||
| WxBillDeposit bd = new WxBillDeposit(); | |||||
| bd.updateTenantInfo(wxMerchant); | |||||
| bd.setStarttime(wxMerchant.getStarttime()); | |||||
| bd.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum rentDepositSum = wxBillRentDepositService.getBillMonthSum(bd); | |||||
| WxBillProperty bp = new WxBillProperty(); | |||||
| bp.updateTenantInfo(wxMerchant); | |||||
| bp.setStarttime(wxMerchant.getStarttime()); | |||||
| bp.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum propertySum = wxBillPropertyService.getBillMonthSum(bp); | |||||
| WxBillPropertyDeposit pd = new WxBillPropertyDeposit(); | |||||
| pd.updateTenantInfo(wxMerchant); | |||||
| pd.setStarttime(wxMerchant.getStarttime()); | |||||
| pd.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum propertyDepositSum = wxBillPropertyDepositService.getBillMonthSum(pd); | |||||
| WxBillDaily bdd = new WxBillDaily(); | |||||
| bdd.updateTenantInfo(wxMerchant); | |||||
| bdd.setStarttime(wxMerchant.getStarttime()); | |||||
| bdd.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum dailySum = wxBillDailyService.getBillMonthSum(bdd); | |||||
| WxBillOther bo = new WxBillOther(); | |||||
| bo.updateTenantInfo(wxMerchant); | |||||
| bo.setStarttime(wxMerchant.getStarttime()); | |||||
| bo.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum otherSum = wxBillOtherService.getBillMonthSum(bo); | |||||
| WxBillOtherDeposit bod = new WxBillOtherDeposit(); | |||||
| bod.updateTenantInfo(wxMerchant); | |||||
| bod.setStarttime(wxMerchant.getStarttime()); | |||||
| bod.setEndtime(wxMerchant.getEndtime()); | |||||
| WxBillSum otherDepositSum = wxBillOtherDepositService.getBillMonthSum(bod); | |||||
| vo.setNeedPay(calcuteSum(rentSum.getNeedPay(),rentManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(), | |||||
| propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay())); | |||||
| vo.setPaid(calcuteSum(rentSum.getPaid(),rentManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(), | |||||
| propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid())); | |||||
| vo.setOwe(calcuteSum(rentSum.getOwe(),rentManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(), | |||||
| propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe())); | |||||
| retList.add(vo); | |||||
| } | |||||
| return new ResultData(retList); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| private String calcuteSum(String... money) { | |||||
| if (null != money) { | |||||
| BigDecimal total = new BigDecimal(0); | |||||
| for (int i = 0 ; i < money.length ; i++) { | |||||
| String _m = money[i]; | |||||
| if (StringUtils.isBlank(_m)) { | |||||
| _m = "0"; | |||||
| } | |||||
| total.add(new BigDecimal(_m)); | |||||
| } | |||||
| return total.setScale(2,RoundingMode.HALF_UP).toPlainString(); | |||||
| } | |||||
| return "0"; | |||||
| } | |||||
| @GetMapping("oweBillCount") | @GetMapping("oweBillCount") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -117,13 +264,13 @@ public class WxBillAllController extends BaseController { | |||||
| wxBillAllService.exportBill(request, response, wxBillAll); | wxBillAllService.exportBill(request, response, wxBillAll); | ||||
| } | } | ||||
| @GetMapping("getBillInfo") | |||||
| @SystemControllerLog(description = "账单总览-获取账单信息") | |||||
| public ResultData getBillInfo(@ModelAttribute WxBillAll wxBillAll) { | |||||
| wxBillAll.updateTenantInfo(getTenantInfo()); | |||||
| Object billInfo = wxBillAllService.getBillInfo(wxBillAll); | |||||
| return new ResultData(billInfo); | |||||
| } | |||||
| // @GetMapping("getBillInfo") | |||||
| // @SystemControllerLog(description = "账单总览-获取账单信息") | |||||
| // public ResultData getBillInfo(@ModelAttribute WxBillAll wxBillAll) { | |||||
| // wxBillAll.updateTenantInfo(getTenantInfo()); | |||||
| // Object billInfo = wxBillAllService.getBillInfo(wxBillAll); | |||||
| // return new ResultData(billInfo); | |||||
| // } | |||||
| /** | /** | ||||
| @@ -1,10 +1,12 @@ | |||||
| package com.iformall.controller.rent; | package com.iformall.controller.rent; | ||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | 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.WxBillRentManage; | import com.iformall.domain.po.WxBillRentManage; | ||||
| import com.iformall.domain.po.WxUserDataRule; | import com.iformall.domain.po.WxUserDataRule; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| @@ -52,6 +54,20 @@ public class WxBillRentManageController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @GetMapping("monthBillSum") | |||||
| public ResultData monthBillSum(@ModelAttribute WxBillRentManage wxBillRentManage) { | |||||
| if (StringUtils.isBlank(wxBillRentManage.getMonth())) { | |||||
| new ResultData(Result.ERROR, "请选择月份"); | |||||
| } | |||||
| wxBillRentManage.updateTenantInfo(getTenantInfo()); | |||||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||||
| if (null != dataRule) { | |||||
| wxBillRentManage.setFloorForRule(dataRule.getFloorIds()); | |||||
| wxBillRentManage.setBusinessForRule(dataRule.getBussinessIds()); | |||||
| } | |||||
| return new ResultData(wxBillRentManageService.getBillMonthSum(wxBillRentManage)); | |||||
| } | |||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData detail(Long id) { | public ResultData detail(Long id) { | ||||
| @@ -97,7 +97,7 @@ public class WxBillRent extends TenantEntity { | |||||
| private String oweStr; | private String oweStr; | ||||
| @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "10") | @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "10") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期", name = "status") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期EnumBillRentStatus", name = "status") | |||||
| private Integer status; | private Integer status; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") | @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") | ||||
| @@ -218,5 +218,8 @@ public class WxBillRentManage extends TenantEntity { | |||||
| private List<Long> merchantIds; | private List<Long> merchantIds; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer hasMerchant; | private Integer hasMerchant; | ||||
| @TableField(exist = false) | |||||
| private String month; | |||||
| } | } | ||||
| @@ -443,5 +443,5 @@ public class WxMerchant extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String initLog; | private String initLog; | ||||
| } | } | ||||
| @@ -0,0 +1,48 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.math.BigDecimal; | |||||
| import java.math.RoundingMode; | |||||
| @Data | |||||
| public class WxMerchantBillVo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long merchantId; | |||||
| @Excel(name = "商户名称", width = 20, orderNum = "2") | |||||
| @TableField(exist = false) | |||||
| private String merchantName;//商户名称 | |||||
| private String needPay; | |||||
| @Excel(name = "应付账单金额(元)", width = 20, orderNum = "3") | |||||
| @TableField(exist = false) | |||||
| private String needPayNumber; | |||||
| public String getNeedPayNumber() { | |||||
| return StringUtils.isBlank(needPay) ? "0" : new BigDecimal(needPay).setScale(2,RoundingMode.HALF_UP).toPlainString(); | |||||
| } | |||||
| private String paid; | |||||
| @Excel(name = "已付账单金额(元)", width = 20, orderNum = "4") | |||||
| @TableField(exist = false) | |||||
| private String paidNumber; | |||||
| public String getPaidNumber() { | |||||
| return StringUtils.isBlank(paid) ? "0" : new BigDecimal(paid).setScale(2,RoundingMode.HALF_UP).toPlainString(); | |||||
| } | |||||
| private String owe; | |||||
| @Excel(name = "欠费账单金额(元)", width = 20, orderNum = "5") | |||||
| @TableField(exist = false) | |||||
| private String oweNumber; | |||||
| public String getOweNumber() { | |||||
| return StringUtils.isBlank(owe) ? "0" : new BigDecimal(owe).setScale(2,RoundingMode.HALF_UP).toPlainString(); | |||||
| } | |||||
| } | |||||
| @@ -1,7 +1,10 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxBillRent; | |||||
| import com.iformall.domain.po.WxBillRentManage; | import com.iformall.domain.po.WxBillRentManage; | ||||
| import com.iformall.domain.vo.WxBillSum; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -29,4 +32,6 @@ public interface WxBillRentManageMapper extends CommonMapper<WxBillRentManage, L | |||||
| void insertBills(List<WxBillRentManage> resultList); | void insertBills(List<WxBillRentManage> resultList); | ||||
| WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage); | |||||
| } | } | ||||
| @@ -37,7 +37,7 @@ public interface WxBillAllService { | |||||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll); | void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll); | ||||
| Object getBillInfo(WxBillAll wxBillAll); | |||||
| //Object getBillInfo(WxBillAll wxBillAll); | |||||
| Long hasOweBill(Long contractId, Integer type); | Long hasOweBill(Long contractId, Integer type); | ||||
| @@ -3,9 +3,11 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | 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.WxBillRent; | |||||
| import com.iformall.domain.po.WxBillRentManage; | import com.iformall.domain.po.WxBillRentManage; | ||||
| import com.iformall.domain.po.WxPayAccountBill; | import com.iformall.domain.po.WxPayAccountBill; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxBillSum; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -65,5 +67,7 @@ public interface WxBillRentManageService { | |||||
| ResultData updateLatePayStatus(WxBillRentManage wxBillRent); | ResultData updateLatePayStatus(WxBillRentManage wxBillRent); | ||||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRentManage wxBillRentManage); | void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRentManage wxBillRentManage); | ||||
| WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage); | |||||
| } | } | ||||
| @@ -1869,28 +1869,28 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| wxBillDailyMapper.updateById(wxBillDaily); | wxBillDailyMapper.updateById(wxBillDaily); | ||||
| } | } | ||||
| @Override | |||||
| public Object getBillInfo(WxBillAll record) { | |||||
| record.setRentShopType(EnumRentShopType.SHOP.getCode()); | |||||
| record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| Map<String, Object> oweInfoForShop = wxBillAllMapper.queryOweInfo(record); | |||||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| Map<String, Object> paidInfoForShop = wxBillAllMapper.queryPaidInfo(record); | |||||
| record.setRentShopType(EnumRentShopType.POINT.getCode()); | |||||
| record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| Map<String, Object> oweInfoForPoint = wxBillAllMapper.queryOweInfo(record); | |||||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| Map<String, Object> paidInfoForPoint = wxBillAllMapper.queryPaidInfo(record); | |||||
| Map<String, Object> result = new HashMap<>(4); | |||||
| result.put("oweInfoForShop", oweInfoForShop); | |||||
| result.put("paidInfoForShop", paidInfoForShop); | |||||
| result.put("oweInfoForPoint", oweInfoForPoint); | |||||
| result.put("paidInfoForPoint", paidInfoForPoint); | |||||
| return result; | |||||
| } | |||||
| // @Override | |||||
| // public Object getBillInfo(WxBillAll record) { | |||||
| // | |||||
| // record.setRentShopType(EnumRentShopType.SHOP.getCode()); | |||||
| // record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| // Map<String, Object> oweInfoForShop = wxBillAllMapper.queryOweInfo(record); | |||||
| // record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| // Map<String, Object> paidInfoForShop = wxBillAllMapper.queryPaidInfo(record); | |||||
| // | |||||
| // record.setRentShopType(EnumRentShopType.POINT.getCode()); | |||||
| // record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| // Map<String, Object> oweInfoForPoint = wxBillAllMapper.queryOweInfo(record); | |||||
| // record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| // Map<String, Object> paidInfoForPoint = wxBillAllMapper.queryPaidInfo(record); | |||||
| // | |||||
| // Map<String, Object> result = new HashMap<>(4); | |||||
| // result.put("oweInfoForShop", oweInfoForShop); | |||||
| // result.put("paidInfoForShop", paidInfoForShop); | |||||
| // result.put("oweInfoForPoint", oweInfoForPoint); | |||||
| // result.put("paidInfoForPoint", paidInfoForPoint); | |||||
| // return result; | |||||
| // } | |||||
| @Override | @Override | ||||
| public Long hasOweBill(Long contractId, Integer type) { | public Long hasOweBill(Long contractId, Integer type) { | ||||
| @@ -16,6 +16,7 @@ import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxPayAccountBill; | import com.iformall.domain.po.WxPayAccountBill; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxBillSum; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxBillActionMapper; | import com.iformall.mapper.WxBillActionMapper; | ||||
| @@ -79,7 +80,7 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { | |||||
| return getBillRentManageList(pageIndex, pageSize, wxBillRentManage, wxPayAccountBill); | return getBillRentManageList(pageIndex, pageSize, wxBillRentManage, wxPayAccountBill); | ||||
| } | } | ||||
| private PageInfo<WxBillRentManage> getBillRentManageList(Integer pageIndex, Integer pageSize,WxBillRentManage wxBillRentManage,WxPayAccountBill wxPayAccountBill) { | |||||
| private void updateQueryParam(WxBillRentManage wxBillRentManage) { | |||||
| if (null != wxBillRentManage.getFloorForRule()) { | if (null != wxBillRentManage.getFloorForRule()) { | ||||
| List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRentManage, wxBillRentManage.getFloorForRule(), null, null, 0, 0); | List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRentManage, wxBillRentManage.getFloorForRule(), null, null, 0, 0); | ||||
| if (null != merchantIds) { | if (null != merchantIds) { | ||||
| @@ -108,6 +109,10 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { | |||||
| wxBillRentManage.setId(-1L); | wxBillRentManage.setId(-1L); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| private PageInfo<WxBillRentManage> getBillRentManageList(Integer pageIndex, Integer pageSize,WxBillRentManage wxBillRentManage,WxPayAccountBill wxPayAccountBill) { | |||||
| updateQueryParam(wxBillRentManage); | |||||
| PageInfo<WxBillRentManage> billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentManageMapper.queryBillManageList(wxBillRentManage)); | PageInfo<WxBillRentManage> billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentManageMapper.queryBillManageList(wxBillRentManage)); | ||||
| if (null == billRentList) { | if (null == billRentList) { | ||||
| return null; | return null; | ||||
| @@ -422,5 +427,11 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { | |||||
| excelService.exportExcel(datalist, null, billName, WxBillRentManage.class, billName + ".xlsx", response, false); | excelService.exportExcel(datalist, null, billName, WxBillRentManage.class, billName + ".xlsx", response, false); | ||||
| } | } | ||||
| @Override | |||||
| public WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage) { | |||||
| updateQueryParam(wxBillRentManage); | |||||
| return wxBillRentManageMapper.getBillMonthSum(wxBillRentManage); | |||||
| } | |||||
| } | } | ||||
| @@ -173,6 +173,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| if(record.getIsAdmin() == null){ | if(record.getIsAdmin() == null){ | ||||
| record.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | record.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | ||||
| } | } | ||||
| Map<Long,WxRentContract> merchantRentMap = new HashMap<Long,WxRentContract>(); | |||||
| initQueryParam(record,false, merchantRentMap); | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | ||||
| } | } | ||||
| @@ -1206,17 +1208,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| } | } | ||||
| // List<Long> isUseMerchantIds = new ArrayList<Long>(); | |||||
| // if(record.getIsUse() != null){ | |||||
| // WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||||
| // wxProfitSharingReceiver.updateTenantInfo(record); | |||||
| // wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||||
| // wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| // wxProfitSharingReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||||
| // isUseMerchantIds = wxProfitSharingReceiverMapper.findMerchantIdList(wxProfitSharingReceiver); | |||||
| // } | |||||
| List<Long> merchantIds = new ArrayList<Long>(); | List<Long> merchantIds = new ArrayList<Long>(); | ||||
| if (record.getCouponId() != null){ | if (record.getCouponId() != null){ | ||||
| @@ -1262,42 +1253,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| } | } | ||||
| // if(EnumProfitSharingUse.YES.getCode().equals(record.getIsUse())){ | |||||
| // if(merchantIds.size() > 0){ | |||||
| // merchantIds.retainAll(isUseMerchantIds); | |||||
| // }else{ | |||||
| // merchantIds.addAll(isUseMerchantIds); | |||||
| // } | |||||
| // } | |||||
| if (merchantIds.size() > 0 ) { | if (merchantIds.size() > 0 ) { | ||||
| record.setIds(merchantIds); | record.setIds(merchantIds); | ||||
| } | } | ||||
| // List<Long> noMerchantIds = new ArrayList<Long>(); | |||||
| // Integer rentShopType = record.getRentShopType(); | |||||
| // if (null != rentShopType) { | |||||
| // WxRentContract rentContractQ = new WxRentContract(); | |||||
| // rentContractQ.updateTenantInfo(record); | |||||
| // rentContractQ.setStatuss(EnumRentContractStatus.getValidStatus()); | |||||
| // List<Long> usedMerchantIds = wxRentContractMapper.getMerchantIdsByStatuss(rentContractQ); | |||||
| // if (null != usedMerchantIds && usedMerchantIds.size() >0 ) { | |||||
| // noMerchantIds.addAll(usedMerchantIds); | |||||
| //// record.setNotInids(usedMerchantIds); | |||||
| // } | |||||
| // } | |||||
| // if(EnumProfitSharingUse.NO.getCode().equals(record.getIsUse())){ | |||||
| // if(noMerchantIds.size() > 0){ | |||||
| // noMerchantIds.retainAll(isUseMerchantIds); | |||||
| // }else{ | |||||
| // noMerchantIds.addAll(isUseMerchantIds); | |||||
| // } | |||||
| // } | |||||
| // if(noMerchantIds.size() > 0){ | |||||
| // record.setNotInids(noMerchantIds); | |||||
| // } | |||||
| Integer rentShopType = record.getRentShopType(); | |||||
| } | } | ||||
| private List<Long> getFloorBuildingMerchantIds(TenantEntity tenantEntity,String floorForRule,Long buildingId,Long floor) { | private List<Long> getFloorBuildingMerchantIds(TenantEntity tenantEntity,String floorForRule,Long buildingId,Long floor) { | ||||
| @@ -112,8 +112,11 @@ | |||||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | ||||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | ||||
| <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> | |||||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||||
| <if test=" null != month and '' != month"> | |||||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||||
| </if> | |||||
| <if test=" null != manageFeeType ">and br.`manage_fee_type` = #{manageFeeType}</if> | <if test=" null != manageFeeType ">and br.`manage_fee_type` = #{manageFeeType}</if> | ||||
| <if test=" null != hasMerchant ">and br.`merchant_id` is not null</if> | <if test=" null != hasMerchant ">and br.`merchant_id` is not null</if> | ||||
| @@ -140,6 +143,16 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||||
| <result column="owe" jdbcType="VARCHAR" property="owe"/> | |||||
| </resultMap> | |||||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillRentManage" resultMap="SumBaseResultMap"> | |||||
| select sum(br.receive_pay) receive_pay , sum(br.pay) paid, sum(br.owe) owe from wx_bill_rent_manage br | |||||
| <include refid="queryBillManageListConditions"/> | |||||
| </select> | |||||
| <select id="queryRentContractIds" parameterType="com.iformall.domain.po.WxBillRentManage" resultType="Long"> | <select id="queryRentContractIds" parameterType="com.iformall.domain.po.WxBillRentManage" resultType="Long"> | ||||
| select distinct br.`rent_contract_id` from wx_bill_rent_manage br | select distinct br.`rent_contract_id` from wx_bill_rent_manage br | ||||
| <include refid="queryBillManageListConditions"/> | <include refid="queryBillManageListConditions"/> | ||||