| @@ -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<WxBillProperty> blist = wxBillPropertyMapper.queryBillPropertyList(br); | |||
| if (null == blist || blist.size() <= 0 ) { | |||
| PageInfo<WxBillProperty> 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(); | |||
| @@ -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<WxBillProperty> 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); | |||
| } | |||
| } | |||
| @@ -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") | |||
| @@ -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); | |||
| @@ -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); | |||
| @@ -76,14 +76,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Override | |||
| public PageInfo<WxBillProperty> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| billRentList.stream().forEach(e -> { | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| return getBillPropertyList(pageIndex, pageSize, wxPayAccountBill, record); | |||
| } | |||
| private PageInfo<WxBillProperty> 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<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| billRentList.stream().forEach(e -> { | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| PageInfo<WxBillProperty> 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<WxBillProperty> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty); | |||
| billPropertyList.stream().forEach(e -> { | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| Map<Long, List<WxBillProperty>> collect = billPropertyList.parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillProperty>>> entries = collect.entrySet(); | |||
| PageInfo<WxBillProperty> billPropertyList = getBillPropertyList(1, 10000, wxPayAccountBill, wxBillProperty); | |||
| List<WxBillProperty> datalist = new ArrayList<>(); | |||
| for (Map.Entry<Long, List<WxBillProperty>> entry : entries) { | |||
| List<WxBillProperty> 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<Map.Entry<String, Object>> 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<Long, List<WxBillProperty>> collect = billPropertyList.getList().parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillProperty>>> entries = collect.entrySet(); | |||
| for (Map.Entry<Long, List<WxBillProperty>> entry : entries) { | |||
| List<WxBillProperty> 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<Map.Entry<String, Object>> 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); | |||
| } | |||
| @@ -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<WxBillRent> 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()); | |||
| //押金 | |||