| @@ -14,8 +14,6 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -38,7 +36,7 @@ public class WxBillDepositController extends BaseController { | |||
| wxBillDeposit = new WxBillDeposit(); | |||
| } | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String, Object>> page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); | |||
| final PageInfo<WxBillDeposit> page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -14,8 +14,6 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -38,7 +36,7 @@ public class WxBillPropertyDepositController extends BaseController { | |||
| wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| } | |||
| wxBillPropertyDeposit.setTenantId(getTenantId()); | |||
| PageInfo<Map<String, Object>> result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); | |||
| PageInfo<WxBillPropertyDeposit> result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -23,6 +23,9 @@ public class WxBillDeposit extends BaseEntity { | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| @TableField(exist = false) | |||
| private String shopNumber; | |||
| @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") | |||
| private Long rentContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | |||
| @@ -21,6 +21,9 @@ public class WxBillPropertyDeposit extends BaseEntity { | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| @TableField(exist = false) | |||
| private String shopNumber; | |||
| @io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId") | |||
| private Long propertyContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | |||
| @@ -14,7 +14,7 @@ public interface WxBillDepositMapper extends CommonMapper<WxBillDeposit, Long> { | |||
| List<WxBillDeposit> findList(WxBillDeposit wxBillDeposit); | |||
| List<Map<String,Object>> queryBillDepositList(WxBillDeposit record); | |||
| List<WxBillDeposit> queryBillDepositList(WxBillDeposit record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| @@ -14,7 +14,7 @@ public interface WxBillPropertyDepositMapper extends CommonMapper<WxBillProperty | |||
| List<WxBillPropertyDeposit> findList(WxBillPropertyDeposit wxBillPropertyDeposit); | |||
| List<Map<String,Object>> queryBillDepositList(WxBillPropertyDeposit record); | |||
| List<WxBillPropertyDeposit> queryBillDepositList(WxBillPropertyDeposit record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| @@ -4,8 +4,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import java.util.Map; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| public interface WxBillDepositService { | |||
| @@ -17,7 +16,7 @@ public interface WxBillDepositService { | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxBillDeposit> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize); | |||
| void updateBillStatus(WxBillDeposit record); | |||
| @@ -27,7 +26,7 @@ public interface WxBillDepositService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| Map<String, Object> getById(Long id); | |||
| WxBillDeposit getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -50,4 +49,7 @@ public interface WxBillDepositService { | |||
| ResultData returnDeposit(WxBillDeposit wxBillDeposit, MallUserInfo user); | |||
| ResultData adjustDeposit(WxBillDeposit wxBillDeposit); | |||
| void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit); | |||
| } | |||
| @@ -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.WxBillPropertyDeposit; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import java.util.Map; | |||
| @@ -20,7 +21,7 @@ public interface WxBillPropertyDepositService { | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxBillPropertyDeposit> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize); | |||
| void updateBillStatus(WxBillPropertyDeposit record); | |||
| @@ -30,7 +31,7 @@ public interface WxBillPropertyDepositService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| Map<String, Object> getById(Long id); | |||
| WxBillPropertyDeposit getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -54,4 +55,5 @@ public interface WxBillPropertyDepositService { | |||
| ResultData adjustDeposit(WxBillPropertyDeposit wxBillPropertyDeposit); | |||
| void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillPropertyDeposit deposit); | |||
| } | |||
| @@ -147,26 +147,31 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| pageInfo.getList().stream().forEach(e->{ | |||
| pageInfo.getList().stream().forEach(e -> { | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| cmputeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| Map<String, Object> result = new HashMap<>(); | |||
| result.put("pageInfo", pageInfo); | |||
| return result; | |||
| } | |||
| public void cmputeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillAllVo e) { | |||
| if (e.getReceivePay() != null) { | |||
| if (e.getLatePayPrice() == null) e.setLatePayPrice(0L); | |||
| BigDecimal servicePay; | |||
| if (e.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll) { | |||
| //更新各账单状态 | |||
| @@ -203,7 +208,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.ROUTINE.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.AIR_CONDITIONING.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.AIR_CONDITIONING.getCode()); | |||
| }else if (wxBillAll.getBillTypeValue().equals(EnumBillType.SETTLE.getCode())) { | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.SETTLE.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.SETTLE.getCode()); | |||
| } else { | |||
| logger.info("账单不存在"); | |||
| @@ -213,28 +218,28 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| if (wxBillAll.getPageIndex() != null && wxBillAll.getPageIndex() != null) { | |||
| PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize()); | |||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||
| for (Map<String, Object> map:maps) { | |||
| Integer billType = ((Long)map.get("billTypeValue")).intValue(); | |||
| if(EnumBillType.SETTLE.getCode().equals(billType)){ | |||
| Long id = (Long)map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id,EnumFilterSettle.YES.getCode()); | |||
| map.put("owe",settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id,EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay",settle.getBalance()); | |||
| for (Map<String, Object> map : maps) { | |||
| Integer billType = ((Long) map.get("billTypeValue")).intValue(); | |||
| if (EnumBillType.SETTLE.getCode().equals(billType)) { | |||
| Long id = (Long) map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); | |||
| map.put("owe", settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay", settle.getBalance()); | |||
| } | |||
| } | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(maps); | |||
| return new ResultData(pageInfo); | |||
| } | |||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||
| for (Map<String, Object> map:maps) { | |||
| Integer billType = ((Long)map.get("billTypeValue")).intValue(); | |||
| if(EnumBillType.SETTLE.getCode().equals(billType)){ | |||
| Long id = (Long)map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id,EnumFilterSettle.YES.getCode()); | |||
| map.put("owe",settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id,EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay",settle.getBalance()); | |||
| for (Map<String, Object> map : maps) { | |||
| Integer billType = ((Long) map.get("billTypeValue")).intValue(); | |||
| if (EnumBillType.SETTLE.getCode().equals(billType)) { | |||
| Long id = (Long) map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); | |||
| map.put("owe", settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay", settle.getBalance()); | |||
| } | |||
| } | |||
| return new ResultData(maps); | |||
| @@ -302,30 +307,30 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| try { | |||
| logger.info("更新结算单id:{}", JsonUtil.obj2Json(bill)); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById((Long)bill.get("id"), EnumFilterSettle.YES.getCode()); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById((Long) bill.get("id"), EnumFilterSettle.YES.getCode()); | |||
| WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||
| settleRecord.setSettleId((Long)bill.get("id")); | |||
| settleRecord.setSettleId((Long) bill.get("id")); | |||
| settleRecord.setSettleMoney(wxBillSettle.getBalance()); | |||
| settleRecord.setSettleTime(new Date()); | |||
| settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); | |||
| settleRecord.setTenantId(wxBillSettle.getTenantId()); | |||
| BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); | |||
| settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage()+"收款"+money.toString()+"元"); | |||
| wxBillSettleRecordService.saveOrUpdate(settleRecord,null,(Long)bill.get("userId")); | |||
| settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage() + "收款" + money.toString() + "元"); | |||
| wxBillSettleRecordService.saveOrUpdate(settleRecord, null, (Long) bill.get("userId")); | |||
| wxBillSettle.setUpdatetime(new Date()); | |||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||
| wxBillSettleMapper.updateById(wxBillSettle); | |||
| logger.info("更新结算单success"); | |||
| }catch (Exception e){ | |||
| logger.error("结算单error",e); | |||
| } catch (Exception e) { | |||
| logger.error("结算单error", e); | |||
| e.printStackTrace(); | |||
| } | |||
| }else{ | |||
| } else { | |||
| logger.info("账单类型不存在"); | |||
| } | |||
| } | |||
| @@ -357,7 +362,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillAllVo.setRentEndTime(DateUtils.format(wxBillAllVo.getEndtime())); | |||
| //status不是欠缴,都展示0,与前端保持一致 | |||
| if(!EnumBillRentStatus.NOT_PAID.getCode().equals(wxBillAllVo.getStatus())){ | |||
| if (!EnumBillRentStatus.NOT_PAID.getCode().equals(wxBillAllVo.getStatus())) { | |||
| wxBillAllVo.setOwe(0l); | |||
| wxBillAllVo.setOweStr("0"); | |||
| } | |||
| @@ -863,14 +868,18 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| String filepath = fmUploadDir; | |||
| String filename = UUID.randomUUID() + ".docx"; | |||
| String exportFileName = "催缴单.docx"; | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); | |||
| } | |||
| @Override | |||
| public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||
| wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); | |||
| if(wxBillSettle.getReceiveBillIds() == null) wxBillSettle.setReceiveBillIds(new ArrayList<>()); | |||
| if(wxBillSettle.getPayBillIds() == null) wxBillSettle.setPayBillIds(new ArrayList<>()); | |||
| if (wxBillSettle.getReceiveBillIds() == null) { | |||
| wxBillSettle.setReceiveBillIds(new ArrayList<>()); | |||
| } | |||
| if (wxBillSettle.getPayBillIds() == null) { | |||
| wxBillSettle.setPayBillIds(new ArrayList<>()); | |||
| } | |||
| //映射结果 | |||
| Map<String, Object> result = new HashMap<>(); | |||
| @@ -884,35 +893,35 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| BigDecimal receiveM = (new BigDecimal(wxBillSettle.getReceiveMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); | |||
| BigDecimal payM = (new BigDecimal(wxBillSettle.getPayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); | |||
| BigDecimal bM = (new BigDecimal(wxBillSettle.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); | |||
| result.put("receiveM", receiveM.toString()+"元"); | |||
| result.put("payM", payM.toString()+"元"); | |||
| result.put("bM", bM.toString()+"元"); | |||
| result.put("receiveM", receiveM.toString() + "元"); | |||
| result.put("payM", payM.toString() + "元"); | |||
| result.put("bM", bM.toString() + "元"); | |||
| result.put("receiveMU", PriceUtil.digitUppercase(receiveM.doubleValue())); | |||
| result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); | |||
| result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); | |||
| WordDocTableVo wordDocTableVo = new WordDocTableVo(); | |||
| List<List<String>> rowsParams = new ArrayList<>(); | |||
| int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size()?wxBillSettle.getReceiveBillIds().size():wxBillSettle.getPayBillIds().size(); | |||
| int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size() ? wxBillSettle.getReceiveBillIds().size() : wxBillSettle.getPayBillIds().size(); | |||
| int count = 1; | |||
| for (int i = 0; i < size ; i++) { | |||
| WxBillSettleBill bill = i>wxBillSettle.getReceiveBillIds().size()-1?null:wxBillSettle.getReceiveBillIds().get(i); | |||
| for (int i = 0; i < size; i++) { | |||
| WxBillSettleBill bill = i > wxBillSettle.getReceiveBillIds().size() - 1 ? null : wxBillSettle.getReceiveBillIds().get(i); | |||
| List<String> cellList = new ArrayList<>(); | |||
| cellList.add(count+""); | |||
| cellList.add(count + ""); | |||
| if(bill != null){ | |||
| if (bill != null) { | |||
| cellList.add(bill.getBillName()); | |||
| cellList.add(new BigDecimal(bill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); | |||
| }else{ | |||
| } else { | |||
| cellList.add(""); | |||
| cellList.add(""); | |||
| } | |||
| cellList.add(count+""); | |||
| WxBillSettleBill payBill = i>wxBillSettle.getPayBillIds().size()-1?null:wxBillSettle.getPayBillIds().get(i); | |||
| if(payBill != null){ | |||
| cellList.add(count + ""); | |||
| WxBillSettleBill payBill = i > wxBillSettle.getPayBillIds().size() - 1 ? null : wxBillSettle.getPayBillIds().get(i); | |||
| if (payBill != null) { | |||
| cellList.add(payBill.getBillName()); | |||
| cellList.add(new BigDecimal(payBill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); | |||
| }else{ | |||
| } else { | |||
| cellList.add(""); | |||
| cellList.add(""); | |||
| } | |||
| @@ -927,7 +936,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| String filepath = fmUploadDir; | |||
| String filename = UUID.randomUUID() + ".docx"; | |||
| String exportFileName = "结算单.docx"; | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,wordDocTableVo); | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, wordDocTableVo); | |||
| } | |||
| @@ -962,7 +971,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| } | |||
| } else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { | |||
| WxBillDeposit dbBill = wxBillDepositMapper.selectById(id); | |||
| if(dbBill!=null) { | |||
| if (dbBill != null) { | |||
| //租赁押金账单更新 | |||
| WxBillDeposit wxBillDeposit = new WxBillDeposit(); | |||
| wxBillDeposit.setId(id); | |||
| @@ -978,7 +987,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| } | |||
| WxBillPropertyDeposit propertyDeposit = wxBillPropertyDepositMapper.selectById(id); | |||
| if(propertyDeposit!=null){ | |||
| if (propertyDeposit != null) { | |||
| //物业押金账单更新 | |||
| WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| wxBillPropertyDeposit.setId(id); | |||
| @@ -1723,7 +1732,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| record.setLimitStart(0); | |||
| record.setLimitEnd(Integer.MAX_VALUE); | |||
| List totalList = wxBillAllMapper.getReceiveAndPayBillAsPage(record); | |||
| if(CollectionUtils.isEmpty(totalList)){ | |||
| if (CollectionUtils.isEmpty(totalList)) { | |||
| PageHelper.startPage(pageNum, pageSize); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo(new ArrayList()); | |||
| pageInfo.setPages(0); | |||
| @@ -1735,12 +1744,12 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| int total = totalList.size(); | |||
| int pages; | |||
| if(total % pageSize == 0){ | |||
| if (total % pageSize == 0) { | |||
| pages = total / pageSize; | |||
| }else{ | |||
| pages = total / pageSize +1; | |||
| } else { | |||
| pages = total / pageSize + 1; | |||
| } | |||
| record.setLimitStart((pageNum -1) * pageSize); | |||
| record.setLimitStart((pageNum - 1) * pageSize); | |||
| record.setLimitEnd(pageSize); | |||
| List<Map<String, Object>> list = wxBillAllMapper.getReceiveAndPayBillAsPage(record); | |||
| @@ -1798,14 +1807,14 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| oweMerchantVo.setName((String) map.get("name")); | |||
| oweMerchantVo.setLinkPhone((String) map.get("linkPhone")); | |||
| oweMerchantVo.setShopNumber((String) map.get("shopNumber")); | |||
| if(EnumRentShopType.POINT.getCode().equals(map.get("type"))){ | |||
| if (EnumRentShopType.POINT.getCode().equals(map.get("type"))) { | |||
| oweMerchantVo.setShopType("多经点位"); | |||
| }else if(EnumRentShopType.SHOP.getCode().equals(map.get("type"))){ | |||
| } else if (EnumRentShopType.SHOP.getCode().equals(map.get("type"))) { | |||
| oweMerchantVo.setShopType("商铺"); | |||
| } | |||
| oweMerchantVo.setReceivePay(map.get("receivePay")==null?"0":map.get("receivePay").toString()); | |||
| oweMerchantVo.setPayOut(map.get("payOut")==null?"0":map.get("payOut").toString()); | |||
| oweMerchantVo.setBalance(map.get("balance")==null?"0":map.get("balance").toString()); | |||
| oweMerchantVo.setReceivePay(map.get("receivePay") == null ? "0" : map.get("receivePay").toString()); | |||
| oweMerchantVo.setPayOut(map.get("payOut") == null ? "0" : map.get("payOut").toString()); | |||
| oweMerchantVo.setBalance(map.get("balance") == null ? "0" : map.get("balance").toString()); | |||
| list.add(oweMerchantVo); | |||
| } | |||
| String name = "商户账单列表"; | |||
| @@ -65,24 +65,27 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| List<WxBillDaily> billDepositList = wxBillDailyMapper.queryBillDailyList(record); | |||
| billDepositList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| //结果放入分页对象 | |||
| PageInfo<WxBillDaily> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillDaily e) { | |||
| if (e.getReceivePay() != null) { | |||
| BigDecimal servicePay; | |||
| if (e.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillDaily record) { | |||
| logger.info("更新日常账单状态开始..."); | |||
| @@ -127,6 +130,9 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| WxBillDaily record = new WxBillDaily(); | |||
| record.setId(id); | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.queryBillDailyList(record).get(0); | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| computeTotalMoney(wxPayAccountBill, record); | |||
| record.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (wxBillDaily.getShopId() != null) { | |||
| WxShop shop = new WxShop(); | |||
| shop.setId(wxBillDaily.getShopId()); | |||
| @@ -135,7 +141,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| }else{ | |||
| wxBillDaily.setShops(Collections.EMPTY_LIST); | |||
| } | |||
| return wxBillDaily; | |||
| } | |||
| @@ -191,7 +196,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| wxBillDaily.setPayDate(record.getPayDate()); | |||
| wxBillDaily.setPay(record.getPay()); | |||
| wxBillDaily.setReceivePay(record.getReceivePay()); | |||
| wxBillDaily.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillDaily.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -351,18 +356,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| List<WxBillDaily> billDailyList = wxBillDailyMapper.queryBillDailyList(record); | |||
| billDailyList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| List<WxBillDailyExportVo> datalist = new ArrayList<>(); | |||
| WxBillDailyExportVo wxBillDailyExportVo; | |||
| @@ -49,29 +49,34 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<WxBillDeposit> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillDepositMapper.queryBillDepositList(record); | |||
| List<WxBillDeposit> billDepositList = wxBillDepositMapper.queryBillDepositList(record); | |||
| billDepositList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.get("receivePay") != null){ | |||
| Long receivePayB = (Long)e.get("receivePay"); | |||
| BigDecimal servicePay; | |||
| if(e.get("serviceChargePay") != null){ | |||
| servicePay = new BigDecimal((Long)e.get("serviceChargePay")); | |||
| }else{ | |||
| servicePay = new BigDecimal(receivePayB).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + receivePayB; | |||
| e.put("realReceivePay",realReceivePay); | |||
| e.put("serviceChargePay",servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| PageInfo<WxBillDeposit> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit) { | |||
| if (deposit.getReceivePay() != null) { | |||
| Long receivePayB = deposit.getReceivePay(); | |||
| BigDecimal servicePay; | |||
| if (deposit.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(deposit.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(receivePayB).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + receivePayB; | |||
| deposit.setRealReceivePay(realReceivePay); | |||
| deposit.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillDeposit record) { | |||
| logger.info("更新租赁押金账单状态开始..."); | |||
| @@ -113,7 +118,7 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| } | |||
| @Override | |||
| public Map<String, Object> getById(Long id) { | |||
| public WxBillDeposit getById(Long id) { | |||
| WxBillDeposit record = new WxBillDeposit(); | |||
| record.setId(id); | |||
| return wxBillDepositMapper.queryBillDepositList(record).get(0); | |||
| @@ -164,7 +169,6 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| wxBillDeposit.setPayDate(date); | |||
| wxBillDeposit.setUpdatetime(date); | |||
| wxBillDeposit.setPayWay(record.getPayWay()); | |||
| //wxBillDeposit.setServiceChargePay(record.getServiceChargePay()); | |||
| try { | |||
| wxBillDepositMapper.updateById(wxBillDeposit); | |||
| } catch (Exception e) { | |||
| @@ -59,18 +59,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| List<WxBillOtherDeposit> billList = wxBillOtherDepositMapper.queryBillList(record); | |||
| billList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| //结果放入分页对象 | |||
| PageInfo<WxBillOtherDeposit> pageInfo = new PageInfo<>(billList); | |||
| @@ -78,6 +67,20 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| } | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillOtherDeposit e) { | |||
| if (e.getReceivePay() != null) { | |||
| BigDecimal servicePay; | |||
| if (e.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillOtherDeposit record) { | |||
| logger.info("更新其他押金账单状态开始..."); | |||
| @@ -122,6 +125,9 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| WxBillOtherDeposit record = new WxBillOtherDeposit(); | |||
| record.setId(id); | |||
| WxBillOtherDeposit wxBillOther = wxBillOtherDepositMapper.queryBillList(record).get(0); | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| computeTotalMoney(wxPayAccountBill, record); | |||
| record.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (wxBillOther.getShopId() != null) { | |||
| WxShop shop = new WxShop(); | |||
| shop.setId(wxBillOther.getShopId()); | |||
| @@ -186,7 +192,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| wxBillOtherDeposit.setPayDate(record.getPayDate()); | |||
| wxBillOtherDeposit.setPay(record.getPay()); | |||
| wxBillOtherDeposit.setReceivePay(record.getReceivePay()); | |||
| wxBillOtherDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||
| wxBillOtherDeposit.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -324,18 +330,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| List<WxBillOtherDeposit> datalist = wxBillOtherDepositMapper.queryBillList(wxBillDeposit); | |||
| datalist.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| excelService.exportExcel(datalist, null, "其他押金账单", WxBillOtherDeposit.class, "其他押金账单.xlsx", response, false); | |||
| } | |||
| @@ -59,18 +59,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| List<WxBillOther> billList = wxBillOtherMapper.queryBillList(record); | |||
| billList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| //结果放入分页对象 | |||
| PageInfo<WxBillOther> pageInfo = new PageInfo<>(billList); | |||
| @@ -78,6 +67,20 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| } | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillOther e) { | |||
| if (e.getReceivePay() != null) { | |||
| BigDecimal servicePay; | |||
| if (e.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillOther record) { | |||
| logger.info("更新其他账单状态开始..."); | |||
| @@ -122,7 +125,9 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| WxBillOther record = new WxBillOther(); | |||
| record.setId(id); | |||
| WxBillOther wxBillOther = wxBillOtherMapper.queryBillList(record).get(0); | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| computeTotalMoney(wxPayAccountBill, record); | |||
| record.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (wxBillOther.getShopId() != null) { | |||
| WxShop shop = new WxShop(); | |||
| shop.setId(wxBillOther.getShopId()); | |||
| @@ -187,7 +192,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| wxBillOther.setPayDate(record.getPayDate()); | |||
| wxBillOther.setPay(record.getPay()); | |||
| wxBillOther.setReceivePay(record.getReceivePay()); | |||
| wxBillOther.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillOther.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -269,18 +274,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| List<WxBillOther> datalist = wxBillOtherMapper.queryBillList(wxBillOther); | |||
| datalist.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| excelService.exportExcel(datalist, null, "其他费用账单", WxBillOther.class, "其他费用账单.xlsx", response, false); | |||
| } | |||
| @@ -47,29 +47,33 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<WxBillPropertyDeposit> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); | |||
| List<WxBillPropertyDeposit> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); | |||
| billDepositList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.get("receivePay") != null){ | |||
| Long receivePayB = (Long)e.get("receivePay"); | |||
| BigDecimal servicePay; | |||
| if(e.get("serviceChargePay") != null){ | |||
| servicePay = new BigDecimal((Long)e.get("serviceChargePay")); | |||
| }else{ | |||
| servicePay = new BigDecimal(receivePayB).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + receivePayB; | |||
| e.put("realReceivePay",realReceivePay); | |||
| e.put("serviceChargePay",servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| PageInfo<WxBillPropertyDeposit> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillPropertyDeposit deposit) { | |||
| if (deposit.getReceivePay() != null) { | |||
| BigDecimal servicePay; | |||
| if (deposit.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(deposit.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(deposit.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + deposit.getReceivePay(); | |||
| deposit.setRealReceivePay(realReceivePay); | |||
| deposit.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillPropertyDeposit record) { | |||
| logger.info("更新物业押金账单状态开始..."); | |||
| @@ -112,7 +116,7 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| } | |||
| @Override | |||
| public Map<String, Object> getById(Long id) { | |||
| public WxBillPropertyDeposit getById(Long id) { | |||
| WxBillPropertyDeposit record = new WxBillPropertyDeposit(); | |||
| record.setId(id); | |||
| return wxBillPropertyDepositMapper.queryBillDepositList(record).get(0); | |||
| @@ -150,7 +154,7 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| Long addpay = wxBillDeposit.getPay(); | |||
| wxBillDeposit.setPay(record.getPay()); | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | |||
| wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillDeposit.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date receiveDate = wxBillDeposit.getReceiveDate(); | |||
| @@ -14,10 +14,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillActionMapper; | |||
| import com.iformall.mapper.WxBillPropertyDepositMapper; | |||
| import com.iformall.mapper.WxBillPropertyMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillPropertyService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -55,6 +52,8 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| WxBillActionMapper wxBillActionMapper; | |||
| @Autowired | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @Autowired | |||
| WxBillPropertyDepositService wxBillPropertyDepositService; | |||
| @Override | |||
| @@ -62,25 +61,33 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| billRentList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| billRentList.stream().forEach(e -> { | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| } | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillProperty e) { | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if (e.getReceivePay() != null) { | |||
| if (e.getLatePayPrice() == null) { | |||
| long latePayPrice = 0L; | |||
| e.setLatePayPrice(latePayPrice); | |||
| } | |||
| BigDecimal servicePay; | |||
| if (e.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillProperty record) { | |||
| logger.info("更新物业账单状态开始..."); | |||
| @@ -125,15 +132,20 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| public WxBillProperty getById(Long id) { | |||
| WxBillProperty record = new WxBillProperty(); | |||
| record.setId(id); | |||
| return wxBillPropertyMapper.queryBillPropertyList(record).get(0); | |||
| WxBillProperty property = wxBillPropertyMapper.queryBillPropertyList(record).get(0); | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(property.getTenantId()); | |||
| computeTotalMoney(wxPayAccountBill, property); | |||
| property.setOwe(property.getRealReceivePay() - property.getPay()); | |||
| return property; | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillProperty record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay()==null?0:record.getReceivePay().intValue(); | |||
| int pay = record.getPay()==null?0:record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| return new ResultData(ErrorCode.BILL_PAY_ERROR,"实收金额不能大于实际应收金额"); | |||
| int receivepay = record.getReceivePay() == null ? 0 : record.getReceivePay().intValue(); | |||
| int pay = record.getPay() == null ? 0 : record.getPay().intValue(); | |||
| if (pay > receivepay) { | |||
| return new ResultData(ErrorCode.BILL_PAY_ERROR, "实收金额不能大于实际应收金额"); | |||
| } | |||
| Date date = new Date(); | |||
| if (record.getId() == null) { | |||
| @@ -142,7 +154,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| record.setOwe(record.getReceivePay()-record.getPay()); | |||
| record.setOwe(record.getReceivePay() - record.getPay()); | |||
| record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| try { | |||
| wxBillPropertyMapper.insert(record); | |||
| @@ -154,16 +166,16 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| } else { | |||
| logger.info("更新物业账单"); | |||
| WxBillProperty property = wxBillPropertyMapper.selectById(record.getId()); | |||
| if(property==null){ | |||
| if (property == null) { | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_IS_NOT_FOUND); | |||
| } | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| if (record.getServiceChargePayUpdate() != null) { | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate()) * 100; | |||
| property.setServiceChargePay(l.intValue()); | |||
| }else{ | |||
| } else { | |||
| Long addpay = property.getPay(); | |||
| property.setRevenue(record.getRevenue()); | |||
| property.setLatePayRatio(record.getLatePayRatio()); | |||
| @@ -172,7 +184,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| property.setPayDate(record.getPayDate()); | |||
| property.setPay(record.getPay()); | |||
| property.setReceivePay(record.getReceivePay()); | |||
| property.setOwe(record.getReceivePay()-record.getPay()); | |||
| property.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| property.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -201,10 +213,10 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| wxBillAction.setBillId(property.getId()); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore()+"元变更为" +record.getServiceChargePayUpdate()+"元"); | |||
| if (record.getServiceChargePayUpdate() != null) { | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore() + "元变更为" + record.getServiceChargePayUpdate() + "元"); | |||
| wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| }else{ | |||
| } else { | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| } | |||
| wxBillAction.setUserId(user.getId()); | |||
| @@ -237,20 +249,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxBillProperty> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| billRentList.stream().forEach(e->{ | |||
| billRentList.stream().forEach(e -> { | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList); | |||
| @@ -262,11 +263,11 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillProperty record = wxBillPropertyMapper.selectById(id); | |||
| if(record==null){ | |||
| if (record == null) { | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_IS_NOT_FOUND); | |||
| } | |||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| Date d = new Date(); | |||
| record.setPayDate(d); | |||
| record.setUpdatetime(d); | |||
| try { | |||
| @@ -285,26 +286,15 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| //押金 | |||
| WxBillPropertyDeposit depositParam = new WxBillPropertyDeposit(); | |||
| depositParam.setPropertyContractId(property.getPropertyContractId()); | |||
| Map<String, Object> deposit = null; | |||
| List<Map<String, Object>> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(depositParam); | |||
| WxBillPropertyDeposit deposit = null; | |||
| List<WxBillPropertyDeposit> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(depositParam); | |||
| if (!billDepositList.isEmpty()) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(property.getTenantId()); | |||
| deposit = billDepositList.get(0); | |||
| } | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(property.getTenantId()); | |||
| if(property.getReceivePay() != null){ | |||
| if(property.getLatePayPrice() == null) property.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(property.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(property.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(property.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + property.getLatePayPrice() + property.getReceivePay(); | |||
| property.setRealReceivePay(realReceivePay); | |||
| property.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| wxBillPropertyDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| } | |||
| Map<String, Object> result = new HashMap<>(2); | |||
| result.put("property", property); | |||
| result.put("deposit", deposit); | |||
| @@ -330,20 +320,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| String billName = wxBillProperty.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业账单" : "多经点位物业账单"; | |||
| List<WxBillProperty> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty); | |||
| billPropertyList.stream().forEach(e->{ | |||
| billPropertyList.stream().forEach(e -> { | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| Map<Long, List<WxBillProperty>> collect = billPropertyList.parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); | |||
| @@ -377,7 +356,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxBillAction billAction = new WxBillAction(); | |||
| if(record.getLatePayMoneyUpdate() != null) { | |||
| if (record.getLatePayMoneyUpdate() != null) { | |||
| record.setLatePayPrice(Long.parseLong(record.getLatePayMoneyUpdate()) * 100); | |||
| billAction.setId(idWorker.nextId()); | |||
| @@ -385,7 +364,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| billAction.setUserName("系统端"); | |||
| billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode()); | |||
| billAction.setBillId(record.getId()); | |||
| billAction.setDetails(record.getLatePayMoneyBefore()+"元变更为" +record.getLatePayMoneyUpdate()+"元"); | |||
| billAction.setDetails(record.getLatePayMoneyBefore() + "元变更为" + record.getLatePayMoneyUpdate() + "元"); | |||
| billAction.setUpdatetime(new Date()); | |||
| wxBillActionMapper.insert(billAction); | |||
| } | |||
| @@ -13,10 +13,7 @@ import com.iformall.domain.vo.RatioVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillRentService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.joda.time.DateTime; | |||
| @@ -59,6 +56,8 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper; | |||
| @Autowired | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @Autowired | |||
| WxBillDepositService wxBillDepositService; | |||
| @Override | |||
| public PageInfo<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| @@ -68,23 +67,29 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(record); | |||
| billRentList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| } | |||
| public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRent rent) { | |||
| if (rent.getReceivePay() != null) { | |||
| if (rent.getLatePayPrice() == null) { | |||
| rent.setLatePayPrice(0L); | |||
| } | |||
| BigDecimal servicePay; | |||
| if (rent.getServiceChargePay() != null) { | |||
| servicePay = new BigDecimal(rent.getServiceChargePay()); | |||
| } else { | |||
| servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + rent.getLatePayPrice() + rent.getReceivePay(); | |||
| rent.setRealReceivePay(realReceivePay); | |||
| rent.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillRent record) { | |||
| logger.info("更新租赁账单状态开始..."); | |||
| @@ -129,7 +134,12 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| public WxBillRent getById(Long id) { | |||
| WxBillRent record = new WxBillRent(); | |||
| record.setId(id); | |||
| return wxBillRentMapper.queryBillRentList(record).get(0); | |||
| WxBillRent rent = wxBillRentMapper.queryBillRentList(record).get(0); | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| computeTotalMoney(wxPayAccountBill, rent); | |||
| rent.setOwe(rent.getRealReceivePay() - rent.getPay()); | |||
| return rent; | |||
| } | |||
| @Override | |||
| @@ -175,7 +185,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| wxBillRent.setLatePayStatus(record.getLatePayStatus()); | |||
| wxBillRent.setPay(record.getPay()); | |||
| wxBillRent.setReceivePay(record.getReceivePay()); | |||
| wxBillRent.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillRent.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -243,18 +253,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| e.setPayRatio(0l); | |||
| } | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| PageInfo<WxBillRent> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| @@ -287,27 +286,14 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| //押金 | |||
| WxBillDeposit depositParam = new WxBillDeposit(); | |||
| depositParam.setRentContractId(rent.getRentContractId()); | |||
| Map<String, Object> deposit = null; | |||
| List<Map<String, Object>> billDepositList = wxBillDepositMapper.queryBillDepositList(depositParam); | |||
| WxBillDeposit deposit = null; | |||
| List<WxBillDeposit> billDepositList = wxBillDepositMapper.queryBillDepositList(depositParam); | |||
| if (!billDepositList.isEmpty()) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(rent.getTenantId()); | |||
| deposit = billDepositList.get(0); | |||
| wxBillDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| } | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(rent.getTenantId()); | |||
| if(rent.getReceivePay() != null){ | |||
| if(rent.getLatePayPrice() == null) rent.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(rent.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(rent.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + rent.getLatePayPrice() + rent.getReceivePay(); | |||
| rent.setRealReceivePay(realReceivePay); | |||
| rent.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| //周期 | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("rent", rent); | |||
| @@ -445,18 +431,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); | |||
| billRentList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| if(e.getReceivePay() != null){ | |||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||
| BigDecimal servicePay; | |||
| if(e.getServiceChargePay() != null){ | |||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||
| }else{ | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| } | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| Map<Long, List<WxBillRent>> collect = billRentList.parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillRent::getMerchantId)); | |||
| @@ -23,6 +23,10 @@ | |||
| <result column="return_price" jdbcType="BIGINT" property="returnPrice"/> | |||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="shop_info" property="shopInfo"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="shop_number" property="shopNumber"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -66,13 +70,11 @@ | |||
| select <include refid="allColumns" /> from wx_bill_rent_deposit | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap"> | |||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | |||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | |||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | |||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType,br.`return_price` returnPrice, | |||
| br.pay_way payWay,br.shop_info shopInfo,br.freeze,br.service_charge_pay serviceChargePay | |||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillDeposit" resultType="BaseResultMap"> | |||
| 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.`rent_shop_type`,br.`return_price`, br.pay_way,br.shop_info ,br.freeze,br.service_charge_pay | |||
| from wx_bill_rent_deposit br left join wx_merchant m on br.merchant_id=m.id | |||
| left join wx_shop s on br.shop_id=s.id | |||
| <where> | |||
| @@ -85,9 +87,8 @@ | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| </where> | |||
| order by id desc | |||
| order by br.id desc | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| @@ -25,6 +25,8 @@ | |||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="shop_number" property="shopNumber"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -69,12 +71,13 @@ | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultType="hashmap"> | |||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | |||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | |||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | |||
| br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType,br.`return_price` returnPrice,br.`shop_info` | |||
| shopInfo,br.pay_way payWay,br.pay_way payWay,br.freeze,br.service_charge_pay serviceChargePay | |||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" | |||
| resultType="BaseResultMap"> | |||
| 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.`rent_shop_type`,br.`return_price`,br.`shop_info`,br.pay_way, | |||
| br.freeze,br.service_charge_pay | |||
| from wx_bill_property_deposit br left join wx_merchant m on br.merchant_id=m.id | |||
| left join wx_shop s on br.shop_id=s.id | |||
| <where> | |||