From b0890e72d826e02f4a9250dd090f55e57a55934a Mon Sep 17 00:00:00 2001 From: winter Date: Sun, 21 Apr 2024 14:52:25 +0800 Subject: [PATCH] fix --- .../market/WxSettleMerchantController.java | 14 ++- .../rent/WxBillPropertyController.java | 15 ++-- .../controller/rent/WxBillRentController.java | 8 +- .../service/WxBillPropertyService.java | 4 +- .../iformall/service/WxBillRentService.java | 5 +- .../impl/WxBillPropertyServiceImpl.java | 89 ++++++++----------- .../service/impl/WxBillRentServiceImpl.java | 10 ++- 7 files changed, 68 insertions(+), 77 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java index 56e9e0a45..eb5aa27f8 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java @@ -14,6 +14,7 @@ import com.iformall.enums.EnumRentContractStatus; import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillPropertyMapper; +import com.iformall.service.WxBillPropertyService; import com.iformall.service.WxBillRentService; import com.iformall.service.WxPropertyContractService; import com.iformall.service.WxRentContractService; @@ -35,6 +36,7 @@ import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.*; @RestController @@ -53,6 +55,10 @@ public class WxSettleMerchantController extends BaseController { WxPropertyContractService wxPropertyContractService; @Autowired WxBillPropertyMapper wxBillPropertyMapper; + + @Lazy + @Autowired + WxBillPropertyService wxBillPropertyService; @ApiOperation("分页列表接口") @GetMapping("list") @@ -205,13 +211,13 @@ public class WxSettleMerchantController extends BaseController { br.setStarttime(wxSettleMerchant.getBeginTime()); br.setEndtime(wxSettleMerchant.getEndTime()); - List blist = wxBillPropertyMapper.queryBillPropertyList(br); - if (null == blist || blist.size() <= 0 ) { + PageInfo blist = wxBillPropertyService.listAsPage(br,1, 10000); + if (null == blist || null == blist.getList() || blist.getList().size() <= 0 ) { return new ResultData(Result.ERROR,"物业合同无对应账单"); } Long all = 0L; - for (int i = 0 ; i < blist.size() ; i ++) { - WxBillProperty r = blist.get(i); + for (int i = 0 ; i < blist.getList().size() ; i ++) { + WxBillProperty r = blist.getList().get(i); Long _np = 0L; if (null != r.getNeedPay()) { _np = r.getNeedPay(); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java index b6fb6777c..c410e6b6c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java @@ -87,10 +87,8 @@ public class WxBillPropertyController extends BaseController { @GetMapping("/findById") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "物业账单-查询") public ResultData findById(Long id) { - logger.debug("[" + getIpAddr() + "] WxBillPropertyController::findById"); - return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.getById(this.getTenantInfo(),id)); } @GetMapping("/updatePaid") @@ -103,10 +101,8 @@ public class WxBillPropertyController extends BaseController { @GetMapping("/detail") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "物业账单-详情") public ResultData detail(Long id) { - logger.debug("[" + getIpAddr() + "] WxBillPropertyController::detail"); - return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.detail(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.detail(this.getTenantInfo(),id)); } @GetMapping("/findByPropertyContractId") @@ -114,7 +110,6 @@ public class WxBillPropertyController extends BaseController { @ApiImplicitParam(name = "propertyContractId", value = "merchantId", dataType = "Long", paramType = "query", required = true), @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - @SystemControllerLog(description = "物业账单-根据商户获取") public ResultData findByPropertyContractId(Long propertyContractId, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxBillPropertyController::findByPropertyContractId"); final PageInfo page = wxBillPropertyService.findByPropertyContractId(propertyContractId, getTenantInfo(), pageNum, pageSize); @@ -125,7 +120,6 @@ public class WxBillPropertyController extends BaseController { @PostMapping("updateLatePayStatus") @SystemControllerLog(description = "物业账单-滞纳金结单") public ResultData updateLatePayStatus(@RequestBody WxBillProperty wxBillProperty) { - logger.debug("[" + getIpAddr() + "] WxBillPropertyController::updateLatePayStatus"); return wxBillPropertyService.updateLatePayStatus(wxBillProperty); } @@ -133,6 +127,11 @@ public class WxBillPropertyController extends BaseController { @SystemControllerLog(description = "物业账单-导出") public void exportBill(@ModelAttribute WxBillProperty wxBillProperty, HttpServletRequest request, HttpServletResponse response) { wxBillProperty.updateTenantInfo(getTenantInfo()); + WxUserDataRule dataRule = this.getCurrentDataFloors(); + if (null != dataRule) { + wxBillProperty.setFloorForRule(dataRule.getFloorForRule()); + wxBillProperty.setBusinessForRule(dataRule.getBusinessForRule()); + } wxBillPropertyService.exportBill(request, response, wxBillProperty); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java index cef9e449d..fc3a8ad60 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java @@ -86,10 +86,8 @@ public class WxBillRentController extends BaseController { @GetMapping("/findById") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "租赁押金账单-id查找") public ResultData findById(Long id) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::findById"); - return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.getById(this.getTenantInfo(),id)); } @GetMapping("/findByRentContractId") @@ -117,10 +115,8 @@ public class WxBillRentController extends BaseController { @GetMapping("/detail") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "租赁押金账单-详情") public ResultData detail(Long id) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::detail"); - return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.detail(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.detail(this.getTenantInfo(),id)); } @PostMapping("updateRevenue") diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java index 2a649b898..26a452dac 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java @@ -33,7 +33,7 @@ public interface WxBillPropertyService { * @param id * @return */ - WxBillProperty getById(Long id); + WxBillProperty getById(TenantEntity tenantEntity,Long id); /** * 保存或更新实体 @@ -63,7 +63,7 @@ public interface WxBillPropertyService { ResultData updatePaid(Long id); - Object detail(Long id); + Object detail(TenantEntity tenantEntity,Long id); ResultData updateLatePayStatus(WxBillProperty wxBillProperty); diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java b/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java index 0bd8346d5..a92e004d8 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillRent; +import com.iformall.domain.po.base.TenantEntity; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,7 +31,7 @@ public interface WxBillRentService { * @param id * @return */ - WxBillRent getById(Long id); + WxBillRent getById(TenantEntity tenantEntity,Long id); /** * 保存或更新实体 @@ -60,7 +61,7 @@ public interface WxBillRentService { ResultData updatePaid(Long id); - Object detail(Long id); + Object detail(TenantEntity tenantEntity,Long id); ResultData updateRevenue(WxBillRent wxBillRent, MallUserInfo user); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java index 7898fce1d..5c0c37ea2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java @@ -76,14 +76,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { @Override public PageInfo listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - PageHelper.startPage(pageIndex, pageSize); - List billRentList = wxBillPropertyMapper.queryBillPropertyList(record); - billRentList.stream().forEach(e -> { - computeTotalMoney(wxPayAccountBill, e); - - }); - PageInfo pageInfo = new PageInfo<>(billRentList); - return pageInfo; + return getBillPropertyList(pageIndex, pageSize, wxPayAccountBill, record); } private PageInfo getBillPropertyList(Integer pageIndex, Integer pageSize,WxPayAccountBill wxPayAccountBill,WxBillProperty record) { @@ -273,13 +266,15 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { } @Override - public WxBillProperty getById(Long id) { + public WxBillProperty getById(TenantEntity tenantEntity,Long id) { + //手续费 = 合同应收+手续费+滞纳金 + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); WxBillProperty record = new WxBillProperty(); record.setId(id); + record.updateTenantInfo(tenantEntity); + getBillPropertyList(1, 10000, wxPayAccountBill, record); WxBillProperty property = wxBillPropertyMapper.queryBillPropertyList(record).get(0); - //手续费 = 合同应收+手续费+滞纳金 - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(property); - computeTotalMoney(wxPayAccountBill, property); + property.setOwe(property.getRealReceivePay() - property.getPay()); return property; } @@ -394,14 +389,8 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { record.setSortColumns(BaseEntity.SortField.Id_ASC); updateBillStatus(record); PageHelper.startPage(pageIndex, pageSize); - List billRentList = wxBillPropertyMapper.queryBillPropertyList(record); - billRentList.stream().forEach(e -> { - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - }); - - PageInfo pageInfo = new PageInfo<>(billRentList); - return pageInfo; + PageInfo billRentList = getBillPropertyList(1, 10000, wxPayAccountBill, record); + return billRentList; } @@ -426,9 +415,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { } @Override - public Object detail(Long id) { + public Object detail(TenantEntity tenantEntity,Long id) { //物业 - WxBillProperty property = getById(id); + WxBillProperty property = getById(tenantEntity,id); //押金 WxBillPropertyDeposit depositParam = new WxBillPropertyDeposit(); depositParam.setPropertyContractId(property.getPropertyContractId()); @@ -464,36 +453,34 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillProperty); String billName = wxBillProperty.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业账单" : "多经点位物业账单"; - List billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty); - billPropertyList.stream().forEach(e -> { - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - }); - Map> collect = billPropertyList.parallelStream() - .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); - Set>> entries = collect.entrySet(); + PageInfo billPropertyList = getBillPropertyList(1, 10000, wxPayAccountBill, wxBillProperty); List datalist = new ArrayList<>(); - for (Map.Entry> entry : entries) { - List list = entry.getValue(); - for (WxBillProperty property : list) { - if (property.getDepositStatus() == null) { - property.setDepositStatus(0); - } - String shopNumber = property.getShopNumber(); - if (StringUtils.isEmpty(shopNumber)) { - String shopInfo = property.getShopInfo(); - if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { - JSONObject jsonObject = JSONObject.parseObject(shopInfo); - StringBuffer sb = new StringBuffer(); - Set> sets = jsonObject.entrySet(); - sets.forEach(x -> sb.append(x.getKey()).append(",")); - if(StringUtils.isNotBlank(sb)){ - property.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); - } - } - } - datalist.add(property); - } + if (null != billPropertyList && null != billPropertyList.getList()) { + Map> collect = billPropertyList.getList().parallelStream() + .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); + Set>> entries = collect.entrySet(); + for (Map.Entry> entry : entries) { + List list = entry.getValue(); + for (WxBillProperty property : list) { + if (property.getDepositStatus() == null) { + property.setDepositStatus(0); + } + String shopNumber = property.getShopNumber(); + if (StringUtils.isEmpty(shopNumber)) { + String shopInfo = property.getShopInfo(); + if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { + JSONObject jsonObject = JSONObject.parseObject(shopInfo); + StringBuffer sb = new StringBuffer(); + Set> sets = jsonObject.entrySet(); + sets.forEach(x -> sb.append(x.getKey()).append(",")); + if(StringUtils.isNotBlank(sb)){ + property.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); + } + } + } + datalist.add(property); + } + } } excelService.exportExcel(datalist, null, billName, WxBillProperty.class, billName + ".xlsx", response, false); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java index 6016b288c..d5f4a9649 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java @@ -8,6 +8,7 @@ import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.RatioVo; import com.iformall.enums.*; import com.iformall.exception.MallinkException; @@ -135,10 +136,11 @@ public class WxBillRentServiceImpl implements WxBillRentService { } @Override - public WxBillRent getById(Long id) { + public WxBillRent getById(TenantEntity tenantEntity,Long id) { WxBillRent record = new WxBillRent(); record.setId(id); - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); + record.updateTenantInfo(tenantEntity); + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); PageInfo rp = getBillRentPropertyList(1,1,record,wxPayAccountBill); WxBillRent rent = rp.getList().get(0); //手续费 = 合同应收+手续费+滞纳金 @@ -273,9 +275,9 @@ public class WxBillRentServiceImpl implements WxBillRentService { } @Override - public Object detail(Long id) { + public Object detail(TenantEntity tenantEntity,Long id) { //租赁 - WxBillRent rent = getById(id); + WxBillRent rent = getById(tenantEntity,id); //合同 WxRentContract wxRentContract = wxRentContractMapper.selectById(rent.getRentContractId()); //押金