winter пре 1 година
родитељ
комит
9fb1d74951
40 измењених фајлова са 2046 додато и 2244 уклоњено
  1. +3
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java
  2. +53
    -385
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java
  3. +7
    -7
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentManageController.java
  4. +4
    -130
      mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java
  5. +5
    -32
      mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java
  6. +30
    -30
      mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java
  7. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/dto/FinanceReceiveCalcuteDTO.java
  8. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/dto/FinanceSetOffDTO.java
  9. +90
    -27
      mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java
  10. +20
    -31
      mallinkService/src/main/java/com/iformall/domain/po/WxBillAdvance.java
  11. +20
    -38
      mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java
  12. +22
    -33
      mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java
  13. +20
    -34
      mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java
  14. +20
    -34
      mallinkService/src/main/java/com/iformall/domain/po/WxBillOtherDeposit.java
  15. +30
    -44
      mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java
  16. +30
    -33
      mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java
  17. +127
    -168
      mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java
  18. +28
    -52
      mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java
  19. +1
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceive.java
  20. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java
  21. +8
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java
  22. +8
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillNotify.java
  23. +35
    -21
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillSum.java
  24. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/vo/WxFinanceReceiveVo.java
  25. +2
    -2
      mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java
  26. +39
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java
  27. +72
    -0
      mallinkService/src/main/java/com/iformall/service/WxAllBillService.java
  28. +3
    -3
      mallinkService/src/main/java/com/iformall/service/WxFinanceService.java
  29. +76
    -816
      mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java
  30. +741
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java
  31. +6
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java
  32. +59
    -61
      mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java
  33. +20
    -20
      mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java
  34. +7
    -7
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  35. +203
    -203
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  36. +2
    -2
      mallinkService/src/main/java/com/iformall/service/payBill/PayBillAdapterService.java
  37. +2
    -2
      mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangMaServiceImpl.java
  38. +2
    -2
      mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/QrDemo.java
  39. +2
    -2
      mallinkService/src/main/java/com/iformall/service/payBill/impl/wx/WxMiniProgramServiceImpl.java
  40. +242
    -0
      mallinkService/src/main/resources/mapper/WxAllBillMapper.xml

+ 3
- 3
mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java Прегледај датотеку

@@ -6,12 +6,12 @@ import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.dto.FinanceSetOffDTO;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxEnergyFees;
import com.iformall.domain.po.WxFinanceReceive;
import com.iformall.domain.po.WxFinanceReceiveSetoff;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.domain.vo.FinanceBillSetoffSum;
import com.iformall.domain.vo.WxFinanceReceiveVo;
import com.iformall.enums.EnumBillAllType;
@@ -194,7 +194,7 @@ public class WxFinanceController extends BaseController {
@PostMapping("calcueteSetoff")
public ResultData calcueteSetoff(@RequestBody FinanceSetOffDTO dto) {
dto.updateTenantInfo(getTenantInfo());
List<WxBillBaseEntity> bill = wxFinanceService.calcuetSetOff(dto,this.getUser());
List<WxAllBill> bill = wxFinanceService.calcuetSetOff(dto,this.getUser());
if (null == bill) {
return new ResultData(Result.ERROR,"未冲抵");
}
@@ -211,7 +211,7 @@ public class WxFinanceController extends BaseController {
if (null == record.getBills() || null == record.getPayWays()) {
return new ResultData(Result.ERROR,"请选择账单和支付方式");
}
List<WxBillBaseEntity> list = wxFinanceService.createReceive(record,this.getUser());
List<WxAllBill> list = wxFinanceService.createReceive(record,this.getUser());
return new ResultData(list);
}


+ 53
- 385
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java Прегледај датотеку

@@ -12,11 +12,11 @@ import com.iformall.domain.dto.WxBillPayDTO;
import com.iformall.domain.dto.WxBillReceiveUpdateDTO;
import com.iformall.domain.po.SysConfig;
import com.iformall.domain.po.WxBillAction;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxEnergyFees;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxUserDataRule;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.domain.vo.WxBillAll;
import com.iformall.domain.vo.WxBillBad;
import com.iformall.domain.vo.WxBillExcelTemplate;
@@ -59,7 +59,6 @@ import java.util.List;
import java.util.Map;

/**
* @author gongbiao
*/
@RestController
@RequestMapping("wxBillAll")
@@ -143,30 +142,13 @@ public class WxBillAllController extends BillBaseController {
wxMerchant.setId(m.getId());
wxMerchant.setBillStatus(billStaus);
WxBillSum rentSum = billAllHelper.getBillRentSum(wxMerchant,starttime, enttime);
WxBillSum rentManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,null);
WxBillSum rentDepositSum = billAllHelper.getBillDepositSum(wxMerchant, starttime, enttime);
WxBillSum propertySum = billAllHelper.getBillPropertySum(wxMerchant, starttime, enttime);
WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDepositSum(wxMerchant, starttime, enttime);
WxBillSum dailySum = billAllHelper.getBillDailySum(wxMerchant, starttime, enttime,null);
WxBillSum otherSum = billAllHelper.getBillOtherSum(wxMerchant, starttime, enttime);
WxBillSum otherDepositSum = billAllHelper.getBillOtherDepositSum(wxMerchant, starttime, enttime);
vo.setNeedPay(billAllHelper.calcuteSum(rentSum.getNeedPay(),rentManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(),
propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay()));
vo.setPaid(billAllHelper.calcuteSum(rentSum.getPaid(),rentManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(),
propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid()));
vo.setOwe(billAllHelper.calcuteSum(rentSum.getOwe(),rentManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(),
propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe()));
vo.setMinDate(billAllHelper.getMinDate(rentSum.getMinDate(),rentManageSum.getMinDate(),rentDepositSum.getMinDate(),propertySum.getMinDate(),
propertyDepositSum.getMinDate(),dailySum.getMinDate(),otherSum.getMinDate(),otherDepositSum.getMinDate()));
vo.setMaxDate(billAllHelper.getMaxDate(rentSum.getMaxDate(),rentManageSum.getMaxDate(),rentDepositSum.getMaxDate(),propertySum.getMaxDate(),
propertyDepositSum.getMaxDate(),dailySum.getMaxDate(),otherSum.getMaxDate(),otherDepositSum.getMaxDate()));
vo.setReturnPay(billAllHelper.calcuteSum(rentSum.getReturnPay(),rentManageSum.getReturnPay(),rentDepositSum.getReturnPay(),propertySum.getReturnPay(),
propertyDepositSum.getReturnPay(),dailySum.getReturnPay(),otherSum.getReturnPay(),otherDepositSum.getReturnPay()));
WxBillSum rentSum = billAllHelper.getBillSum(wxMerchant,starttime, enttime);
vo.setNeedPay(rentSum.getNeedPay());
vo.setPaid(rentSum.getPaid());
vo.setOwe(rentSum.getOwe());
vo.setMinDate(rentSum.getMinDate());
vo.setMaxDate(rentSum.getMaxDate());
vo.setReturnPay(rentSum.getReturnPay());
retList.add(vo);
}
@@ -226,34 +208,34 @@ public class WxBillAllController extends BillBaseController {
if (null != wxMerchant.getOnlyOwe() && EnumYesOrNo.YES.getCode().intValue() == wxMerchant.getOnlyOwe().intValue()) {
wxMerchant.setOweBillBeforeDays(getOweBillBeforeDays());
}
WxBillSum rentSum = billAllHelper.getBillRentSum(wxMerchant,starttime, enttime);
WxBillSum rentBussinessManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE);
WxBillSum rentOperationManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE);
WxBillSum rentDepositSum = billAllHelper.getBillDepositSum(wxMerchant, starttime, enttime);
WxBillSum propertySum = billAllHelper.getBillPropertySum(wxMerchant, starttime, enttime);
WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDepositSum(wxMerchant, starttime, enttime);
WxBillSum dailySum = billAllHelper.getBillDailySum(wxMerchant, starttime, enttime,null);
WxBillSum otherSum = billAllHelper.getBillOtherSum(wxMerchant, starttime, enttime);
WxBillSum otherDepositSum = billAllHelper.getBillOtherDepositSum(wxMerchant, starttime, enttime);
vo.setNeedPay(billAllHelper.calcuteSum(rentSum.getNeedPay(),rentBussinessManageSum.getNeedPay(),rentOperationManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(),
propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay()));
vo.setPaid(billAllHelper.calcuteSum(rentSum.getPaid(),rentBussinessManageSum.getPaid(),rentOperationManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(),
propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid()));
vo.setOwe(billAllHelper.calcuteSum(rentSum.getOwe(),rentBussinessManageSum.getOwe(),rentOperationManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(),
propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe()));
List<WxBillSum> sumlist = new ArrayList<>();
sumlist.add(rentSum);
sumlist.add(rentBussinessManageSum);
sumlist.add(rentOperationManageSum);
sumlist.add(rentDepositSum);
sumlist.add(propertySum);
sumlist.add(propertyDepositSum);
sumlist.add(dailySum);
sumlist.add(otherSum);
sumlist.add(otherDepositSum);
vo.setBillSumList(sumlist);
// WxBillSum rentSum = billAllHelper.getBillRentSum(wxMerchant,starttime, enttime);
// WxBillSum rentBussinessManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE);
// WxBillSum rentOperationManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE);
// WxBillSum rentDepositSum = billAllHelper.getBillDepositSum(wxMerchant, starttime, enttime);
// WxBillSum propertySum = billAllHelper.getBillPropertySum(wxMerchant, starttime, enttime);
// WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDepositSum(wxMerchant, starttime, enttime);
// WxBillSum dailySum = billAllHelper.getBillDailySum(wxMerchant, starttime, enttime,null);
// WxBillSum otherSum = billAllHelper.getBillOtherSum(wxMerchant, starttime, enttime);
// WxBillSum otherDepositSum = billAllHelper.getBillOtherDepositSum(wxMerchant, starttime, enttime);
//
// vo.setNeedPay(billAllHelper.calcuteSum(rentSum.getNeedPay(),rentBussinessManageSum.getNeedPay(),rentOperationManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(),
// propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay()));
// vo.setPaid(billAllHelper.calcuteSum(rentSum.getPaid(),rentBussinessManageSum.getPaid(),rentOperationManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(),
// propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid()));
// vo.setOwe(billAllHelper.calcuteSum(rentSum.getOwe(),rentBussinessManageSum.getOwe(),rentOperationManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(),
// propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe()));
//
// List<WxBillSum> sumlist = new ArrayList<>();
// sumlist.add(rentSum);
// sumlist.add(rentBussinessManageSum);
// sumlist.add(rentOperationManageSum);
// sumlist.add(rentDepositSum);
// sumlist.add(propertySum);
// sumlist.add(propertyDepositSum);
// sumlist.add(dailySum);
// sumlist.add(otherSum);
// sumlist.add(otherDepositSum);
// vo.setBillSumList(sumlist);
return new ResultData(vo);
}
@@ -310,19 +292,7 @@ public class WxBillAllController extends BillBaseController {
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData oweBillList(@ModelAttribute WxMerchant wxMerchant,Integer billType, Integer pageNum, Integer pageSize) {
if (null == billType) {
return new ResultData(Result.ERROR,"请选择分类");
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
return new ResultData(getBillList(wxMerchant, btype, true,null, pageNum, pageSize));
return new ResultData(getBillList(wxMerchant, true,null, pageNum, pageSize));
}
@GetMapping("nearBillList")
@@ -330,22 +300,10 @@ public class WxBillAllController extends BillBaseController {
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData nearBillList(@ModelAttribute WxMerchant wxMerchant,Integer billType, Integer pageNum, Integer pageSize) {
if (null == billType) {
return new ResultData(Result.ERROR,"请选择分类");
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
return new ResultData(getBillList(wxMerchant, btype, true,getNearBillBeforeDays(), pageNum, pageSize));
return new ResultData(getBillList(wxMerchant, true,getNearBillBeforeDays(), pageNum, pageSize));
}
private PageInfo getBillList(WxMerchant wxMerchant,EnumBillAllType btype,boolean isOwe,Integer nearBillBeforeDays, Integer pageNum, Integer pageSize) {
private PageInfo<WxAllBill> getBillList(WxMerchant wxMerchant,boolean isOwe,Integer nearBillBeforeDays, Integer pageNum, Integer pageSize) {
wxMerchant.updateTenantInfo(getTenantInfo());
WxUserDataRule dataRule = this.getCurrentDataFloors();
if (null != dataRule) {
@@ -357,7 +315,7 @@ public class WxBillAllController extends BillBaseController {
}
wxMerchant.setNearBillBeforeDays(nearBillBeforeDays);
return billAllHelper.getBillList(btype, wxMerchant,pageNum,pageSize);
return billAllHelper.getBillList(wxMerchant,pageNum,pageSize);
}
/**
@@ -369,45 +327,21 @@ public class WxBillAllController extends BillBaseController {
*/
@GetMapping("exportOweBillList")
public void oweBillList(@ModelAttribute WxMerchant wxMerchant,Integer billType, HttpServletRequest request, HttpServletResponse response) {
if (null == billType) {
return ;
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return ;
}
}
PageInfo page = getBillList(wxMerchant, btype, true,null, 1, 10000);
PageInfo page = getBillList(wxMerchant, true,null, 1, 10000);
if (null == page) {
return;
}
excelService.exportExcel(page.getList(), null, "逾期账单列表", WxBillBaseEntity.class, "商户欠缴账单_"+btype.getMessage()+".xlsx", response, false);
excelService.exportExcel(page.getList(), null, "逾期账单列表", WxAllBill.class, "商户欠缴账单.xlsx", response, false);
}
//临期
@GetMapping("exportNearBillList")
public void exportNearBillList(@ModelAttribute WxMerchant wxMerchant,Integer billType, HttpServletRequest request, HttpServletResponse response) {
if (null == billType) {
return ;
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return ;
}
}
PageInfo page = getBillList(wxMerchant, btype, true,getNearBillBeforeDays(), 1, 10000);
PageInfo page = getBillList(wxMerchant, true,getNearBillBeforeDays(), 1, 10000);
if (null == page) {
return;
}
excelService.exportExcel(page.getList(), null, "临期账单列表", WxBillBaseEntity.class, "商户临期账单_"+btype.getMessage()+".xlsx", response, false);
excelService.exportExcel(page.getList(), null, "临期账单列表", WxAllBill.class, "商户临期账单.xlsx", response, false);
}
/**
@@ -450,40 +384,16 @@ public class WxBillAllController extends BillBaseController {
*/
@GetMapping("oweBillSum")
public ResultData oweBillSum(@ModelAttribute WxMerchant wxMerchant,Integer billType) {
if (null == billType) {
return new ResultData(Result.ERROR,"请选择分类");
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
return new ResultData(getBillSum(wxMerchant, btype, null));
return new ResultData(getBillSum(wxMerchant, null));
}
//临期账单金额
@GetMapping("nearBillSum")
public ResultData nearBillSum(@ModelAttribute WxMerchant wxMerchant,Integer billType) {
if (null == billType) {
return new ResultData(Result.ERROR,"请选择分类");
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
return new ResultData(getBillSum(wxMerchant, btype, getNearBillBeforeDays()));
return new ResultData(getBillSum(wxMerchant,getNearBillBeforeDays()));
}
private WxBillSum getBillSum(WxMerchant wxMerchant,EnumBillAllType btype,Integer nearBillBeforeDays) {
private WxBillSum getBillSum(WxMerchant wxMerchant,Integer nearBillBeforeDays) {
wxMerchant.updateTenantInfo(getTenantInfo());
WxUserDataRule dataRule = this.getCurrentDataFloors();
if (null != dataRule) {
@@ -494,7 +404,7 @@ public class WxBillAllController extends BillBaseController {
wxMerchant.setNearBillBeforeDays(nearBillBeforeDays);
Date starttime = wxMerchant.getStarttime();
Date enttime = wxMerchant.getEndtime();
return billAllHelper.getBillSum(btype, wxMerchant,starttime,enttime);
return billAllHelper.getBillSum(wxMerchant,starttime,enttime);
}
/**
@@ -506,19 +416,7 @@ public class WxBillAllController extends BillBaseController {
*/
@GetMapping("exportOneOweBill")
public void exportOneOweBill(Long id,Integer billType, HttpServletRequest request, HttpServletResponse response) {
if (null == billType) {
return ;
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return ;
}
}
WxBillBaseEntity bill = billAllHelper.getOneBill(getTenantInfo(), btype, id);
WxAllBill bill = billAllHelper.getOneBill(getTenantInfo(), id);
if (null == bill) {
return;
}
@@ -528,19 +426,7 @@ public class WxBillAllController extends BillBaseController {
//临期
@GetMapping("exportOneNearBill")
public void exportOneNearBill(Long id,Integer billType, HttpServletRequest request, HttpServletResponse response) {
if (null == billType) {
return ;
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return ;
}
}
WxBillBaseEntity bill = billAllHelper.getOneBill(getTenantInfo(), btype, id);
WxAllBill bill = billAllHelper.getOneBill(getTenantInfo(),id);
if (null == bill) {
return;
}
@@ -697,20 +583,8 @@ public class WxBillAllController extends BillBaseController {
//商户待结算账单
@GetMapping("settleList")
public ResultData settleList(@ModelAttribute WxMerchant wxMerchant,Integer billType) {
if (null == billType || null == wxMerchant.getId()) {
return new ResultData(Result.ERROR,"参数错误");
}
EnumBillAllType btype;
if (billType.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billType);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
wxMerchant.setBillStatus(EnumBillStatus.STOP_TO_SETTLE.getCode());
return new ResultData(getBillList(wxMerchant, btype, false,getNearBillBeforeDays(), 1, 100));
return new ResultData(getBillList(wxMerchant, false,getNearBillBeforeDays(), 1, 100));
}
//商户待结算账单
@@ -729,7 +603,7 @@ public class WxBillAllController extends BillBaseController {
}
wxMerchant.updateTenantInfo(getTenantInfo());
wxMerchant.setNeedPayPreDays(getNearBillBeforeDays());
List<WxBillBaseEntity> list = billAllHelper.getMerchantBillList(wxMerchant);
List<WxAllBill> list = billAllHelper.getMerchantBillList(wxMerchant);
if (null != list && list.size() > 0 ) {
List<Long> merchnatIds = new ArrayList<Long>();
merchnatIds.add(wxMerchant.getId());
@@ -743,7 +617,7 @@ public class WxBillAllController extends BillBaseController {
fq.updateTenantInfo(m);
Map<Long, WxEnergyFees> feesMap = wxEnergyService.getFeesMap(fq);
for (int i = 0 ; i < list.size(); i++) {
WxBillBaseEntity be = list.get(i);
WxAllBill be = list.get(i);
if (StringUtils.isBlank(be.getShopNumber())) {
be.setShopNumber(shopNumber);
}
@@ -758,211 +632,5 @@ public class WxBillAllController extends BillBaseController {
}
return new ResultData(list);
}
//###################################### 老代码 ######################################
//
// @GetMapping("exportOweBill")
// @SystemControllerLog(description = "费用收缴数据-生成催缴单")
// public void exportOweBill(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::exportOweBill");
// if (null == wxBillAll) {
// wxBillAll = new WxBillAll();
// }
// //默认查当月第一天到今天
// if (StringUtils.isNotBlank(wxBillAll.getEndtime())) {
// wxBillAll.setEndtime(wxBillAll.getEndtime() + " 23:59:59");
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
//
// wxBillAllService.exportOweBill(wxBillAll, request, response);
// }
//
// /**
// * 欠缴商户列表
// * @param wxBillAll
// * @param pageNum
// * @param pageSize
// * @return
// */
// @GetMapping("oweMerchantlist")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// @SystemControllerLog(description = "费用收缴数据-欠缴商户列表")
// public ResultData oweMerchantlist(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::oweMerchantlist");
// if (null == wxBillAll) {
// wxBillAll = new WxBillAll();
// }
// //默认查当月第一天到今天
// if(StringUtils.isNotBlank(wxBillAll.getEndtime())){
// wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59");
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// Map<String, Object> result = wxBillAllService.getOweBillAsPage(wxBillAll, pageNum, pageSize);
// return new ResultData(result);
// }
//
//
//
// @GetMapping("oweBillCount")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "contractId", value = "合同id", dataType = "long", paramType = "query", required = true),
// @ApiImplicitParam(name = "type", value = "类型1租赁合同2物业合同", dataType = "int", paramType = "query", required = true)})
// @SystemControllerLog(description = "账单总览-总额")
// public ResultData oweBillCount(Long contractId, Integer type) {
// Long count = wxBillAllService.hasOweBill(contractId, type);
// return new ResultData(count);
// }
//
// @GetMapping("list")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// @SystemControllerLog(description = "账单总览-列表")
// public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::list");
// wxBillAll.updateTenantInfo(getTenantInfo());
// if (null == wxBillAll) {
// wxBillAll = new WxBillAll();
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// if(StringUtils.isNotBlank(wxBillAll.getStatusListStr())){
// wxBillAll.setStatusList(new ArrayList<>());
// JSONArray jsonArray = JSONArray.parseArray(wxBillAll.getStatusListStr());
// for (int i = 0; i <jsonArray.size() ; i++) {
// Integer o = (Integer) jsonArray.get(i);
// wxBillAll.getStatusList().add(o);
// }
// }
// if(StringUtils.isNotBlank(wxBillAll.getTypeListStr())){
// wxBillAll.setTypeList(new ArrayList<>());
// JSONArray jsonArray = JSONArray.parseArray(wxBillAll.getTypeListStr());
// for (int i = 0; i <jsonArray.size() ; i++) {
// Integer o = (Integer) jsonArray.get(i);
// wxBillAll.getTypeList().add(o);
// }
// }
// Map<String, Object> result = wxBillAllService.listAsPage(wxBillAll, pageNum, pageSize);
// return new ResultData(result);
// }
//
// @GetMapping("detail")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "id", value = "编号", dataType = "long", paramType = "query", required = true),
// @ApiImplicitParam(name = "type", value = "类型", dataType = "int", paramType = "query", required = true)})
// public ResultData detail( Long id, Integer type) {
// Map<String, Object> result = wxBillAllService.detail(id, type);
// Long merchantId = (Long) result.get("merchantId");
// WxMerchant merchant = wxMerchantService.getById(merchantId);
// if (null != merchant) {
// result.put("merchantName", merchant.getName());
// }
// return new ResultData(result);
// }
//
// @GetMapping("allDepositList")
// @SystemControllerLog(description = "账单总览-所有押金列表")
// public ResultData allDepositList(@ModelAttribute WxBillAll wxBillAll) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::allDepositList");
// if (null == wxBillAll) {
// wxBillAll = new WxBillAll();
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// return new ResultData(wxBillAllService.allDepositList(wxBillAll));
// }


// @GetMapping("getBillInfo")
// @SystemControllerLog(description = "账单总览-获取账单信息")
// public ResultData getBillInfo(@ModelAttribute WxBillAll wxBillAll) {
// wxBillAll.updateTenantInfo(getTenantInfo());
// Object billInfo = wxBillAllService.getBillInfo(wxBillAll);
// return new ResultData(billInfo);
// }


// /**
// * 应收、承付商户列表
// * @param wxBillAll
// * @param pageNum
// * @param pageSize
// * @return
// */
// @GetMapping("receiveAndPayMerchantlist")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// @SystemControllerLog(description = "账单管理-应收、承付商户列表")
// @ApiOperation("应收、承付商户列表")
// public ResultData receiveAndPayMerchantlist(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::receiveAndPayMerchantlist");
// if (null == wxBillAll) {
// wxBillAll = new WxBillAll();
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// PageInfo<Map> page = wxBillAllService.getReceiveAndPayBillAsPage(wxBillAll, pageNum, pageSize);
// Map<String, Object> result = new HashMap<>();
// result.put("pageInfo", page);
// return new ResultData(result);
// }
//
// /**
// * 导出应收、承付商户列表
// * @param wxBillAll
// * @return
// */
// @GetMapping("exportReceiveAndPayMerchantlist")
// @SystemControllerLog(description = "账单管理-导出应收、承付商户列表")
// @ApiOperation("导出应收、承付商户列表")
// public void exportReceiveAndPayMerchantlist(@ModelAttribute WxBillAll wxBillAll,HttpServletRequest request, HttpServletResponse response) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::exportReceiveAndPayMerchantlist");
// if (null == wxBillAll) {
// wxBillAll = new WxBillAll();
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// wxBillAllService.exportReceiveAndPayBillAsPage(wxBillAll, request,response);
// }
//
//
// @ApiOperation("导出欠缴商户列表")
// @GetMapping("/exportOweMerchantlist")
// @SystemControllerLog(description = "费用收缴数据-欠缴商户列表-导出")
// public void exportOweMerchantlist(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::exportOweMerchantlist");
// if (null == wxBillAll){
// wxBillAll = new WxBillAll();
// }
// //默认查当月第一天到今天
// if(StringUtils.isNotBlank(wxBillAll.getEndtime())){
// wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59");
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// wxBillAllService.exportOweMerchant(wxBillAll, request, response);
// }
//
// @ApiOperation("导出待缴商户列表")
// @GetMapping("/exportWaitMerchantlist")
// @SystemControllerLog(description = "费用收缴数据-待缴商户列表-导出")
// public void exportWaitMerchantlist(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::exportWaitMerchantlist");
// if (null == wxBillAll){
// wxBillAll = new WxBillAll();
// }
// //默认查当月第一天到今天
// if(StringUtils.isNotBlank(wxBillAll.getEndtime())){
// wxBillAll.setEndtime(wxBillAll.getEndtime()+" 23:59:59");
// }
// wxBillAll.updateTenantInfo(getTenantInfo());
// wxBillAllService.exportWaitMerchant(wxBillAll, request, response);
// }
//
// @GetMapping("exportTemplate")
// @SystemControllerLog(description = "账单-导出模板")
// public void exportTemplate(@ModelAttribute WxBillExcelTemplate wxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response) {
// logger.debug("[" + getIpAddr() + "] WxBillAllController::exportTemplate");
// wxBillAllService.exportTemplate(wxBillExcelTemplate, request, response);
// }

}

+ 7
- 7
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentManageController.java Прегледај датотеку

@@ -119,12 +119,12 @@ public class WxBillRentManageController extends BillBaseController {
public ResultData add(@RequestBody WxBillRentManage wxBillRentManage) {
logger.debug("[" + getIpAddr() + "] WxBillRentController::add");
wxBillRentManage.updateTenantInfo(getTenantInfo());
if (null == wxBillRentManage.getManageFeeType()) {
return new ResultData(Result.ERROR, "参数错误", null);
}
if (null == EnumRentContractManageFeeType.getEnum(wxBillRentManage.getManageFeeType())) {
return new ResultData(Result.ERROR, "参数错误", null);
}
// if (null == wxBillRentManage.getManageFeeType()) {
// return new ResultData(Result.ERROR, "参数错误", null);
// }
// if (null == EnumRentContractManageFeeType.getEnum(wxBillRentManage.getManageFeeType())) {
// return new ResultData(Result.ERROR, "参数错误", null);
// }
return wxBillRentManageService.saveOrUpdate(wxBillRentManage, getUser());
}

@@ -148,7 +148,7 @@ public class WxBillRentManageController extends BillBaseController {
if (null == EnumRentContractManageFeeType.getEnum(manageFeeType)) {
return new ResultData(Result.ERROR, "参数错误", null);
}
record.setManageFeeType(manageFeeType);
//record.setManageFeeType(manageFeeType);
final PageInfo<WxBillRentManage> page = wxBillRentManageService.findByRentContractId(record, pageNum, pageSize);
return new ResultData(page);
}


+ 4
- 130
mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java Прегледај датотеку

@@ -8,12 +8,12 @@ import com.iformall.common.SysConfigConstant;
import com.iformall.domain.dto.WxBillPayDTO;
import com.iformall.domain.po.SysConfig;
import com.iformall.domain.po.WxBillAction;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxFlowModel;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.WxUserDataRule;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.domain.vo.WxBillAll;
import com.iformall.domain.vo.WxBillHotNotify;
import com.iformall.enums.EnumBillAllType;
@@ -52,7 +52,6 @@ import java.util.List;
import java.util.Map;

/**
* @author gongbiao
*/
@RestController
@Api(description = "账单")
@@ -172,19 +171,7 @@ public class WxBillController extends BaseController {

@ApiOperation("分类查询账单")
@RequestMapping("listBill")
public ResultData listBill(@ModelAttribute WxMerchant wxMerchant,Integer billTypeValue, Integer pageNum, Integer pageSize) {
if (null == billTypeValue) {
return new ResultData(Result.ERROR,"请选择分类");
}
EnumBillAllType btype;
if (billTypeValue.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billTypeValue);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
public ResultData listBill(@ModelAttribute WxMerchant wxMerchant,Integer pageNum, Integer pageSize) {
if (null != wxMerchant.getOnlyOweOrNear()) {
if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxMerchant.getOnlyOweOrNear().intValue()) {
wxMerchant.setOweBillBeforeDays(getOweBillBeforeDays());
@@ -195,7 +182,7 @@ public class WxBillController extends BaseController {
}
wxMerchant.setId(this.getLoginBUser().getMerchantId());
wxMerchant.updateTenantInfo(getTenantInfo());
return new ResultData(billAllHelper.getBillList(btype, wxMerchant,pageNum,pageSize));
return new ResultData(billAllHelper.getBillList(wxMerchant,pageNum,pageSize));
}
@ApiOperation("账单详情")
@@ -273,7 +260,7 @@ public class WxBillController extends BaseController {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(this.getLoginBUser().getMerchantId());
wxMerchant.updateTenantInfo(getTenantInfo());
WxBillBaseEntity billdetail = billAllHelper.getBillDetail(btype, wxMerchant,billId);
WxAllBill billdetail = billAllHelper.getBillDetail(btype, wxMerchant,billId);
if (null == billdetail) {
return new ResultData(Result.ERROR,"账单支付未查询到");
}
@@ -298,118 +285,5 @@ public class WxBillController extends BaseController {
return new ResultData(Result.ERROR,"账单支付错误:"+e.getMessage());
}
}
// @ApiOperation("分类查询账单")
// @PostMapping("listBill")
// public ResultData listBill(@RequestBody WxBillAll wxBillAll) {
//
// if(StringUtils.isEmpty(wxBillAll.getTenantId())){
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId不能为空");
// }
// if(wxBillAll.getMerchantId()==null){
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId不能为空");
// }
// if(wxBillAll.getBillTypeValue()==null){
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"billTypeValue不能为空");
// }
// WxMerchant wxMerchant = wxMerchantService.getById(wxBillAll.getMerchantId());
// if(wxMerchant==null){
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
// }
// if(wxMerchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())){
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
// }
// if(!StringUtils.isEmpty(wxBillAll.getStarttime()) && StringUtils.isEmpty(wxBillAll.getEndtime())){
// logger.info("开始时间和结束时间要同时存在或不存在");
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"starttime和endtime要同时存在或不存在");
// }
// if(StringUtils.isEmpty(wxBillAll.getStarttime()) && !StringUtils.isEmpty(wxBillAll.getEndtime())){
// logger.info("开始时间和结束时间要同时存在或不存在");
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"starttime和endtime要同时存在或不存在");
// }
//
// return wxBillAllService.pageListBill(wxBillAll,wxMerchant,true,true,true);
// }

// @GetMapping("/findSettleById")
// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
// @ApiOperation("账单管理-结算单-id查找")
// public ResultData findById(Long id) {
// return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()));
// }
//
// @ApiOperation("完结账单")
// @PostMapping("finishBill")
// public ResultData finishBill(@RequestBody WxBillAll wxBillAll) {
// if(!billFinishHasWorkFlow(wxBillAll)) {
// return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"商户账单完结审批不存在工作流,不能提交审批。");
// }
// WxMerchantBUser buser = getLoginBUser();
//
// Map<String,Object> billObject = wxBillAllService.detail(wxBillAll.getId(), wxBillAll.getBillTypeValue());
//
// if (null == billObject) {
// return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"查询不到记录。");
// }
//
// Map<String,Object> map = new HashMap<String,Object>();
// map.put("businessType", EnumFlowKey.BILL_FINISH.getCode());
// //map.put("payMoney", wxBillAll.getNewPrice());
// map.put("businessId", wxBillAll.getId());
// List<Map> variablesList = new ArrayList<Map>();
// Map billTypeMap = new HashMap<String,Object>();
// billTypeMap.put("key","billType");
// billTypeMap.put("value",wxBillAll.getBillTypeValue());
// variablesList.add(billTypeMap);
//
// Map billUpdateTypeMap = new HashMap<String,Object>();
// billUpdateTypeMap.put("key","billUpdateType");
// billUpdateTypeMap.put("value",EnumBillUpdateType.OTHER.getCode());
// variablesList.add(billUpdateTypeMap);
//
// Long needPayL = (Long) billObject.get("needPay");
// Integer needPay = 0;
// if (null == needPayL) {
// needPay = needPayL.intValue();
// }
//
// Map oldPriceMap = new HashMap<String,Object>();
// oldPriceMap.put("key","oldPrice");
// oldPriceMap.put("value",needPay);
// variablesList.add(oldPriceMap);
//
// Map newPriceMap = new HashMap<String,Object>();
// newPriceMap.put("key","newPrice");
// newPriceMap.put("value",needPay);
// variablesList.add(newPriceMap);
//
// Map forcePaidMap = new HashMap<String,Object>();
// forcePaidMap.put("key","forcePaid");
// forcePaidMap.put("value",1);
// variablesList.add(forcePaidMap);
//
// Map payImgMap = new HashMap<String,Object>();
// payImgMap.put("key","payImg");
// payImgMap.put("value",wxBillAll.getPayImg());
// variablesList.add(payImgMap);
//
// map.put("variables", variablesList);
// map.put("phone", buser.getPhone());
// wxFlowService.start(map, buser.getId(), buser.getName(), this.getTenantInfo());
// return new ResultData();
// }
//
// private boolean billFinishHasWorkFlow(WxBillAll wxBillAll) {
// WxFlowModel wxFlowModel = new WxFlowModel();
// wxFlowModel.setFlowType(EnumFlowKey.BILL_FINISH.getCode());
// wxFlowModel.updateTenantInfo(this.getTenantInfo());
// List<WxFlowModel> flows = wxFlowService.getModelBybusiness(wxFlowModel);
// if (null != flows && flows.size() > 0) {
// return true;
// }
// return false;
// }

}

+ 5
- 32
mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java Прегледај датотеку

@@ -72,7 +72,6 @@ import java.util.List;
import java.util.Map;

/**
* @author gongbiao
*/
@RestController
@Api(description = "商管操作台")
@@ -206,18 +205,6 @@ public class WxMallAdminController extends BaseController {
@GetMapping("listBill")
public ResultData listBill(@ModelAttribute WxMerchant wxMerchant,Integer billTypeValue, Integer pageNum, Integer pageSize) {
setQueryDataRule(wxMerchant);
if (null == billTypeValue) {
return new ResultData(Result.ERROR,"请选择分类");
}
EnumBillAllType btype;
if (billTypeValue.intValue() == Constant.bill_all_type_manage_fee) {
btype = EnumBillAllType.RENT_BUSSINESS_MANAGE;
}else {
btype = EnumBillAllType.getEnum(billTypeValue);
if (null == btype) {
return new ResultData(Result.ERROR,"分类非法");
}
}
if (null != wxMerchant.getOnlyOweOrNear()) {
if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxMerchant.getOnlyOweOrNear().intValue()) {
wxMerchant.setOweBillBeforeDays(getOweBillBeforeDays());
@@ -226,7 +213,7 @@ public class WxMallAdminController extends BaseController {
wxMerchant.setNearBillBeforeDays(getNearBillBeforeDays());
}
}
return new ResultData(billAllHelper.getBillList(btype, wxMerchant,pageNum,pageSize));
return new ResultData(billAllHelper.getBillList( wxMerchant,pageNum,pageSize));
}
@ApiOperation("账单详情")
@@ -257,25 +244,11 @@ public class WxMallAdminController extends BaseController {
setQueryDataRule(wxMerchant);
Date starttime = wxMerchant.getStarttime();
Date enttime = wxMerchant.getEndtime();
WxBillSum rentSum = billAllHelper.getBillRentSum(wxMerchant,starttime, enttime);
WxBillSum rentManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,null);
WxBillSum rentDepositSum = billAllHelper.getBillDepositSum(wxMerchant, starttime, enttime);
WxBillSum propertySum = billAllHelper.getBillPropertySum(wxMerchant, starttime, enttime);
WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDepositSum(wxMerchant, starttime, enttime);
WxBillSum dailySum = billAllHelper.getBillDailySum(wxMerchant, starttime, enttime,null);
WxBillSum otherSum = billAllHelper.getBillOtherSum(wxMerchant, starttime, enttime);
WxBillSum otherDepositSum = billAllHelper.getBillOtherDepositSum(wxMerchant, starttime, enttime);
String needpay = billAllHelper.calcuteSum(rentSum.getNeedPay(),rentManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(),
propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay());
String paid = billAllHelper.calcuteSum(rentSum.getPaid(),rentManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(),
propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid());
String owe = billAllHelper.calcuteSum(rentSum.getOwe(),rentManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(),
propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe());
WxBillSum rentSum = billAllHelper.getBillSum(wxMerchant,starttime, enttime);
Map retMap = new HashMap();
retMap.put("needPay", needpay);
retMap.put("paid", paid);
retMap.put("owe", owe);
retMap.put("needPay", rentSum.getNeedPay());
retMap.put("paid", rentSum.getPaid());
retMap.put("owe", rentSum.getOwe());
return new ResultData(retMap);
}


+ 30
- 30
mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java Прегледај датотеку

@@ -202,35 +202,35 @@ public class ContractSchedule {
}
/**
* 凌晨5分,联营扣点和面积联营取高的需要根据接单数据来更新账单,取高的那一个
*/
@Async
@Scheduled(cron = "0 5 0 * * ?")
//@Scheduled(cron = "0 */2 * * * *?")
public void updateRentBill() {
//查询记租中的联营扣点或者取高的合同,每天更新账单截止时间为前一天的账单。
List<WxMall> wxMalls = wxMallMapper.findList(null);
for (WxMall wxMall : wxMalls) {
WxRentContract rentContract = new WxRentContract();
rentContract.updateTenantInfo(wxMall);
List<Integer> typeList = new ArrayList<Integer>();
typeList.add(EnumRentContractType.RENT_BY_JOINT.getCode());
typeList.add(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode());
rentContract.setTypeList(typeList);
rentContract.setStatus(EnumRentContractStatus.PAING.getCode());
List<WxRentContract> contractList = wxRentContractService.findList(rentContract);
if (null != contractList && contractList.size() > 0 ) {
for (int i = 0 ; i < contractList.size(); i++ ) {
WxRentContract rc = contractList.get(i);
try {
wxRentContractService.calcuteByTradeDaily(rc);
}catch(Exception e) {
log.error("rentcontract updateRentBill error.",e);
}
}
}
}
}
// /**
// * 凌晨5分,联营扣点和面积联营取高的需要根据接单数据来更新账单,取高的那一个
// */
// @Async
// @Scheduled(cron = "0 5 0 * * ?")
// //@Scheduled(cron = "0 */2 * * * *?")
// public void updateRentBill() {
// //查询记租中的联营扣点或者取高的合同,每天更新账单截止时间为前一天的账单。
// List<WxMall> wxMalls = wxMallMapper.findList(null);
// for (WxMall wxMall : wxMalls) {
// WxRentContract rentContract = new WxRentContract();
// rentContract.updateTenantInfo(wxMall);
// List<Integer> typeList = new ArrayList<Integer>();
// typeList.add(EnumRentContractType.RENT_BY_JOINT.getCode());
// typeList.add(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode());
// rentContract.setTypeList(typeList);
// rentContract.setStatus(EnumRentContractStatus.PAING.getCode());
// List<WxRentContract> contractList = wxRentContractService.findList(rentContract);
// if (null != contractList && contractList.size() > 0 ) {
// for (int i = 0 ; i < contractList.size(); i++ ) {
// WxRentContract rc = contractList.get(i);
// try {
// wxRentContractService.calcuteByTradeDaily(rc);
// }catch(Exception e) {
// log.error("rentcontract updateRentBill error.",e);
// }
// }
// }
// }
// }

}

+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/dto/FinanceReceiveCalcuteDTO.java Прегледај датотеку

@@ -3,8 +3,8 @@ package com.iformall.domain.dto;
import java.math.BigDecimal;
import java.util.List;

import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;

import lombok.Data;



+ 2
- 2
mallinkService/src/main/java/com/iformall/domain/dto/FinanceSetOffDTO.java Прегледај датотеку

@@ -2,8 +2,8 @@ package com.iformall.domain.dto;

import java.util.List;

import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;

import lombok.Data;

@@ -12,6 +12,6 @@ import lombok.Data;
@Data
public class FinanceSetOffDTO extends TenantEntity{
private static final long serialVersionUID = 3024690696283760441L;
private List<WxBillBaseEntity> bills;
private List<WxAllBill> bills;
private List<Long> feesIdList;
}

mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java → mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java Прегледај датотеку

@@ -1,4 +1,4 @@
package com.iformall.domain.po.base;
package com.iformall.domain.po;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.JSONObject;
@@ -8,6 +8,7 @@ import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.FinanceSetOffDetailVo;
import com.iformall.enums.EnumBillAction;
import com.iformall.enums.EnumBillAllType;

import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -20,14 +21,15 @@ import java.util.Date;
import java.util.List;

/**
* @author gongbiao
*/
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillBaseEntity extends TenantEntity {
public class WxAllBill extends TenantEntity {

protected Long id;
private static final long serialVersionUID = -1483045953636485476L;

protected Long id;

@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
public Long merchantId;
@@ -62,6 +64,10 @@ public class WxBillBaseEntity extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="创建用户名称",name="createBy")
public String updateByName;

@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
public String needPay;
@Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="实际应收金额(做了减免之后和need可能不一样)",name="receivePay")
public String receivePay;
@@ -70,8 +76,15 @@ public class WxBillBaseEntity extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay")
public String pay;
@io.swagger.annotations.ApiModelProperty(value = "收款单ID", name = "advanceId")
public Long advanceId;
@io.swagger.annotations.ApiModelProperty(value = "账单类型EnumBillAllType", name = "billType")
public Integer billType;
@Excel(name = "账单类型名称", width = 20, orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="账单类型名称",name="billTypeName")
@TableField(exist = false)
public String billTypeName;
public String getBillTypeName() {
return EnumBillAllType.RENT.getMessage();
}
@io.swagger.annotations.ApiModelProperty(value = "支付方式", name = "payWay")
public Long payWay;
@@ -126,25 +139,20 @@ public class WxBillBaseEntity extends TenantEntity {
@TableField(exist = false)
public String energyFeesName;

//@Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="实际应收金额(加上了滞纳金服务费等费用)",name="realReceivePay")
@TableField(exist = false)
public String realReceivePay;

@Excel(name = "账单类型名称", width = 20, orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="账单类型名称",name="billTypeName")
@TableField(exist = false)
public String billTypeName;
@TableField(exist = false)
public Integer billType;
//已退款金额
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="已退还金额",name="returnPay")
public String returnPay;
@TableField(exist = false)
private String remainReturnPrice;//剩余待退回金额
public String getRemainReturnPrice() {
if (StringUtils.isBlank(returnPay)) {
returnPay = "0";
}
return new BigDecimal(getOwe()).subtract(new BigDecimal(returnPay)).toPlainString();
}
@Excel(name = "备注", width = 20, orderNum = "9")
@io.swagger.annotations.ApiModelProperty(value="备注",name="billRemark")
@TableField(exist = false)
public String billRemark;
@Excel(name = "最近催缴时间",format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "10")
@@ -154,7 +162,41 @@ public class WxBillBaseEntity extends TenantEntity {
@Excel(name = "最近催缴人员", width = 20, orderNum = "11")
@io.swagger.annotations.ApiModelProperty(value="最近催缴时间",name="lastOweCallUser")
public String lastOweCallUser;
@io.swagger.annotations.ApiModelProperty(value="租金里面的商业管理费",name="bussinessManageFeeNeedPay")
public String bussinessManageFeeNeedPay;
@io.swagger.annotations.ApiModelProperty(value="租金里面的营业管理费",name="operatingManageFeeNeedPay")
public String operatingManageFeeNeedPay;
@io.swagger.annotations.ApiModelProperty(value="归属商铺ID,非必须",name="shopId")
public Long shopId;
@Excel(name = "商铺号", width = 20, orderNum = "1")
public String shopNumber;
@io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo")
public String shopInfo;
@io.swagger.annotations.ApiModelProperty(value = "预览账单0否1是", name = "isPreview")
public Integer isPreview;
@io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId")
public Long rentContractId;
@io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId")
public Long propertyContractId;
@io.swagger.annotations.ApiModelProperty(value="主物账单ID(针对合同里面的自定义科目账单)",name="parentBillId")
public Long parentBillId;
@io.swagger.annotations.ApiModelProperty(value = "能源抄表计算ID", name = "energyReadingCalcuteId")
private Long energyReadingCalcuteId;
@io.swagger.annotations.ApiModelProperty(value = "能源抄表ID", name = "energyReadingId")
private Long energyReadingId;
@io.swagger.annotations.ApiModelProperty(value="楼座号",name="building")
@TableField(exist = false)
public Long building;
@@ -163,31 +205,37 @@ public class WxBillBaseEntity extends TenantEntity {
@TableField(exist = false)
public Long floor;
@Excel(name = "商铺号", width = 20, orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value="实际应收金额(加上了滞纳金服务费等费用)",name="realReceivePay")
@TableField(exist = false)
public String shopNumber;
public String realReceivePay;
//滞纳金
@TableField(exist = false)
public String billLatePay;
//服务费
@TableField(exist = false)
public String billServicePay;
public String serviceChargePay;
@TableField(exist = false)
public String billAllNeedPay;
public String getBillAllNeedPay() {
String bl = this.getBillLatePay();
String bs = this.getBillServicePay();
if (StringUtils.isBlank(bl)) {
bl = "0";
}
if (StringUtils.isBlank(bs)) {
bs = "0";
if (StringUtils.isBlank(serviceChargePay)) {
serviceChargePay = "0";
}
//取2位小数用于支付,直接进一位分
return new BigDecimal(getOwe()).add(new BigDecimal(bl)).add(new BigDecimal(bs)).setScale(2, RoundingMode.UP).toPlainString();
return new BigDecimal(getOwe()).add(new BigDecimal(bl)).add(new BigDecimal(serviceChargePay)).setScale(2, RoundingMode.UP).toPlainString();
}
@TableField(exist = false)
private String totalFee;//租金合同创建时,所有的应收费用
public void calcuteTotalFee(Integer decimalSize) {
this.totalFee = new BigDecimal(this.receivePay).add(new BigDecimal(bussinessManageFeeNeedPay)).add(new BigDecimal(operatingManageFeeNeedPay))
.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString();
}
@TableField(exist = false)
@@ -227,4 +275,19 @@ public class WxBillBaseEntity extends TenantEntity {
@TableField(exist = false)
private Date shopEndtime;
@TableField(exist = false)
public List<WxAllBill> childList;
@TableField(exist = false)
private Integer hasMerchant;
@TableField(exist = false)
private Integer hasParentBillId;
@TableField(exist = false)
private Integer hasFeesStardarsId;
@TableField(exist = false)
private List<Long> propertyContractIds;
@TableField(exist = false)
private List<Long> notInIds;
}

+ 20
- 31
mallinkService/src/main/java/com/iformall/domain/po/WxBillAdvance.java Прегледај датотеку

@@ -2,7 +2,6 @@ package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -14,42 +13,32 @@ import lombok.ToString;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillAdvance extends WxBillBaseEntity {
public class WxBillAdvance extends WxAllBill {

private static final long serialVersionUID = -4337916787670692258L;
@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
private String remark;
@Override
public Integer getBillType() {
return EnumBillAllType.ADVANCE.getCode();
}
@Override
public String getBillTypeName() {
return EnumBillAllType.ADVANCE.getMessage();
}
@Override
public String getBillRemark() {
return remark;
}
@Override
public String getReturnPay() {
return "0";
}
@Override
public String getBillLatePay() {
return "0";
}
@Override
public String getBillServicePay() {
return "0";
}
// @Override
// public String getBillRemark() {
// return remark;
// }
//
// @Override
// public String getReturnPay() {
// return "0";
// }
//
// @Override
// public String getBillLatePay() {
// return "0";
// }
//
// @Override
// public String getBillServicePay() {
// return "0";
// }

@TableField(exist = false)
private String totalFee;


+ 20
- 38
mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java Прегледај датотеку

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;
import com.iformall.enums.EnumBillDailyType;

@@ -24,7 +23,7 @@ import java.util.List;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillDaily extends WxBillBaseEntity {
public class WxBillDaily extends WxAllBill {
/**
*
*/
@@ -109,40 +108,23 @@ public class WxBillDaily extends WxBillBaseEntity {
@TableField(exist = false)
private List<Long> notInIds;
@Override
public Integer getBillType() {
return EnumBillAllType.DAILY.getCode();
}
@Override
public String getBillTypeName() {
if (this.type == EnumBillDailyType.WATER.getCode()) {
return EnumBillDailyType.WATER.getMessage();
}else if (this.type == EnumBillDailyType.POWER.getCode()) {
return EnumBillDailyType.POWER.getMessage();
}else if (this.type == EnumBillDailyType.AIR_CONDITIONING.getCode()) {
return EnumBillDailyType.AIR_CONDITIONING.getMessage();
}
return EnumBillAllType.DAILY.getMessage();
}
@Override
public String getBillRemark() {
return remark;
}
@Override
public String getReturnPay() {
return "0";
}
@Override
public String getBillLatePay() {
return "0";
}
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public String getBillRemark() {
// return remark;
// }
//
// @Override
// public String getReturnPay() {
// return "0";
// }
//
// @Override
// public String getBillLatePay() {
// return "0";
// }
//
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
}

+ 22
- 33
mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java Прегледај датотеку

@@ -4,7 +4,6 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;

import cn.afterturn.easypoi.excel.annotation.Excel;
@@ -21,13 +20,11 @@ import java.util.List;
@TableName(value = "wx_bill_rent_deposit")
@Data
@EqualsAndHashCode(callSuper = true)
public class WxBillDeposit extends WxBillBaseEntity {
public class WxBillDeposit extends WxAllBill {

@Excel(name = "租金合同ID", width = 20, orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId")
private Long rentContractId;
@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
private String needPay;
@io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate")
private Date receiveDate;
@io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay")
@@ -47,14 +44,6 @@ public class WxBillDeposit extends WxBillBaseEntity {

@io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice")
private String returnPrice;
@TableField(exist = false)
private String remainReturnPrice;//剩余待退回金额
public String getRemainReturnPrice() {
if (StringUtils.isBlank(returnPrice)) {
returnPrice = "0";
}
return new BigDecimal(getOwe()).subtract(new BigDecimal(returnPrice)).toPlainString();
}

@io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo")
private String shopInfo;
@@ -65,8 +54,8 @@ public class WxBillDeposit extends WxBillBaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
private String serviceChargePay;
@io.swagger.annotations.ApiModelProperty(value = "合同押金详细", name = "contractDepoistDetail")
private String contractDepoistDetail;
// @io.swagger.annotations.ApiModelProperty(value = "合同押金详细", name = "contractDepoistDetail")
// private String contractDepoistDetail;

@TableField(exist = false)
private String serviceChargePayBefore;
@@ -87,23 +76,23 @@ public class WxBillDeposit extends WxBillBaseEntity {
return EnumBillAllType.RENT_DEPOSIT.getMessage();
}
@Override
public String getBillRemark() {
return "";
}
@Override
public String getReturnPay() {
return this.returnPrice;
}
@Override
public String getBillLatePay() {
return "0";
}
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public String getBillRemark() {
// return "";
// }
//
// @Override
// public String getReturnPay() {
// return this.returnPrice;
// }
//
// @Override
// public String getBillLatePay() {
// return "0";
// }
//
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
}

+ 20
- 34
mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java Прегледај датотеку

@@ -5,7 +5,6 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;

import lombok.Data;
@@ -25,7 +24,7 @@ import org.apache.commons.lang3.StringUtils;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillOther extends WxBillBaseEntity {
public class WxBillOther extends WxAllBill {

/**
*
@@ -64,9 +63,6 @@ public class WxBillOther extends WxBillBaseEntity {
@TableField(exist = false)
private Integer allPeriod;

@TableField(exist = false)
private Long needPay;

@TableField(exist = false)
private Long latePayPrice;

@@ -98,33 +94,23 @@ public class WxBillOther extends WxBillBaseEntity {
@TableField(exist = false)
private List<Long> notInIds;
@Override
public Integer getBillType() {
return EnumBillAllType.OTHER.getCode();
}
@Override
public String getBillTypeName() {
return EnumBillAllType.OTHER.getMessage();
}
@Override
public String getBillRemark() {
return StringUtils.trimToEmpty(name)+StringUtils.trimToEmpty(comments);
}
@Override
public String getReturnPay() {
return "0";
}
@Override
public String getBillLatePay() {
return "0";
}
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public String getBillRemark() {
// return StringUtils.trimToEmpty(name)+StringUtils.trimToEmpty(comments);
// }
//
// @Override
// public String getReturnPay() {
// return "0";
// }
//
// @Override
// public String getBillLatePay() {
// return "0";
// }
//
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
}

+ 20
- 34
mallinkService/src/main/java/com/iformall/domain/po/WxBillOtherDeposit.java Прегледај датотеку

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;

import lombok.Data;
@@ -26,7 +25,7 @@ import org.apache.commons.lang3.StringUtils;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillOtherDeposit extends WxBillBaseEntity {
public class WxBillOtherDeposit extends WxAllBill {

@io.swagger.annotations.ApiModelProperty(value = "账单名称", name = "name")
private String name;
@@ -68,9 +67,6 @@ public class WxBillOtherDeposit extends WxBillBaseEntity {
@TableField(exist = false)
private Integer allPeriod;

@TableField(exist = false)
private Long needPay;

@TableField(exist = false)
private Long latePayPrice;

@@ -115,34 +111,24 @@ public class WxBillOtherDeposit extends WxBillBaseEntity {
@TableField(exist = false)
private List<Long> notInIds;
@Override
public Integer getBillType() {
return EnumBillAllType.OTHER_DEPOSIT.getCode();
}
@Override
public String getBillTypeName() {
return EnumBillAllType.OTHER_DEPOSIT.getMessage();
}
@Override
public String getBillRemark() {
return StringUtils.trimToEmpty(name)+StringUtils.trimToEmpty(comments);
}
@Override
public String getReturnPay() {
return this.returnPrice;
}
@Override
public String getBillLatePay() {
return "0";
}
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public String getBillRemark() {
// return StringUtils.trimToEmpty(name)+StringUtils.trimToEmpty(comments);
// }
//
// @Override
// public String getReturnPay() {
// return this.returnPrice;
// }
//
// @Override
// public String getBillLatePay() {
// return "0";
// }
//
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
}

+ 30
- 44
mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java Прегледај датотеку

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.domain.vo.WxBillFeesStandardsListVo;
import com.iformall.enums.EnumBillAllType;

@@ -19,25 +18,18 @@ import java.util.Date;
import java.util.List;

/**
* @author gongbiao
*/
@TableName(value = "wx_bill_property")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillProperty extends WxBillBaseEntity {
public class WxBillProperty extends WxAllBill {

/**
*
*/
private static final long serialVersionUID = -4019665043805504986L;

@io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId")
private Long propertyContractId;

@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
private String needPay;
//@Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "10")
@io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate")
private Date receiveDate;
@@ -89,9 +81,6 @@ public class WxBillProperty extends WxBillBaseEntity {
private String comments;
@io.swagger.annotations.ApiModelProperty(value="主物业账单ID",name="parentBillId")
private Long parentBillId;

@TableField(exist = false)
private Integer allPeriod;

@@ -134,35 +123,35 @@ public class WxBillProperty extends WxBillBaseEntity {
@TableField(exist = false)
private List<Long> merchantIds;
@Override
public Integer getBillType() {
return EnumBillAllType.PROPERTY.getCode();
}
@Override
public String getBillTypeName() {
return EnumBillAllType.PROPERTY.getMessage();
}
@Override
public String getBillRemark() {
return comments;
}
@Override
public String getReturnPay() {
return "0";
}
@Override
public String getBillLatePay() {
return latePayPrice;
}
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public Integer getBillType() {
// return EnumBillAllType.PROPERTY.getCode();
// }
//
// @Override
// public String getBillTypeName() {
// return EnumBillAllType.PROPERTY.getMessage();
// }
//
// @Override
// public String getBillRemark() {
// return comments;
// }
//
// @Override
// public String getReturnPay() {
// return "0";
// }
//
// @Override
// public String getBillLatePay() {
// return latePayPrice;
// }
//
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
@TableField(exist = false)
private String totalFee;
@@ -171,9 +160,6 @@ public class WxBillProperty extends WxBillBaseEntity {
@TableField(exist = false)
List<WxBillFeesStandardsListVo> unFixedbillFeesStandardsList;
@TableField(exist = false)
List<WxBillProperty> childList;
@TableField(exist = false)
private Integer hasParentBillId;
@TableField(exist = false)


+ 30
- 33
mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java Прегледај датотеку

@@ -6,7 +6,6 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;

import cn.afterturn.easypoi.excel.annotation.Excel;
@@ -24,13 +23,11 @@ import java.util.List;
@TableName(value = "wx_bill_property_deposit")
@Data
@EqualsAndHashCode(callSuper = true)
public class WxBillPropertyDeposit extends WxBillBaseEntity {
public class WxBillPropertyDeposit extends WxAllBill {

@Excel(name = "物业合同ID", width = 20, orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId")
private Long propertyContractId;
@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
private String needPay;
@io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate")
private Date receiveDate;
@io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay")
@@ -90,34 +87,34 @@ public class WxBillPropertyDeposit extends WxBillBaseEntity {
return sb.toString();
}
@Override
public Integer getBillType() {
return EnumBillAllType.PROPERTY_DEPOSIT.getCode();
}
@Override
public String getBillTypeName() {
return EnumBillAllType.PROPERTY_DEPOSIT.getMessage();
}
@Override
public String getBillRemark() {
return "";
}
@Override
public String getReturnPay() {
return this.returnPrice;
}
@Override
public String getBillLatePay() {
return "0";
}
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public Integer getBillType() {
// return EnumBillAllType.PROPERTY_DEPOSIT.getCode();
// }
//
// @Override
// public String getBillTypeName() {
// return EnumBillAllType.PROPERTY_DEPOSIT.getMessage();
// }
//
// @Override
// public String getBillRemark() {
// return "";
// }
//
// @Override
// public String getReturnPay() {
// return this.returnPrice;
// }
//
// @Override
// public String getBillLatePay() {
// return "0";
// }
//
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
}

+ 127
- 168
mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java Прегледај датотеку

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;

import lombok.Data;
@@ -26,191 +25,151 @@ import java.util.List;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillRent extends WxBillBaseEntity {
public class WxBillRent extends WxAllBill {


@io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId")
private Long rentContractId;

@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
private String needPay;
//@Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "13")
@io.swagger.annotations.ApiModelProperty(value="收款截止日期,过了有手续费",name="receiveDate")
private Date receiveDate;
// @io.swagger.annotations.ApiModelProperty(value="收款截止日期,过了有手续费",name="receiveDate")
// private Date receiveDate;
//@Excel(name = "逾期(天) ", width = 20, orderNum = "14")
@io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay")
private Long expiredDay;
// @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay")
// private Long expiredDay;

@io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus")
private Integer applyStatus;
@io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg")
private String applyPayImg;
@io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime")
private Date applyUpdateTime;
// @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus")
// private Integer applyStatus;
// @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg")
// private String applyPayImg;
// @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime")
// private Date applyUpdateTime;

@io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel")
private Integer isDel;
// @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel")
// private Integer isDel;

@io.swagger.annotations.ApiModelProperty(value="原合同应收金额",name="contractNeedPay")
@Excel(name = "原合同应收金额(元)", width = 20, orderNum = "6")
private String contractNeedPay;
// @io.swagger.annotations.ApiModelProperty(value="原合同应收金额",name="contractNeedPay")
// @Excel(name = "原合同应收金额(元)", width = 20, orderNum = "6")
// private String contractNeedPay;

@io.swagger.annotations.ApiModelProperty(value = "合同应收明细", name = "rentPriceInfo")
private String rentPriceInfo;

@Excel(name = "原合同应收金额明细(元)", width = 20, height = 30, orderNum = "7")
@TableField(exist = false)
private String rentPriceInfoStr;
public String getRentPriceInfoStr() {
String infoStr = "";
if(StringUtils.isNotBlank(this.getRentPriceInfo())){
JSONObject jsonObject = JSONObject.parseObject(this.getRentPriceInfo());
String rentPrice1 = jsonObject.getString("rentPrice");
infoStr += "租金:" + (StringUtils.isBlank(rentPrice1) ? "0":rentPrice1) + "\n";
String siteMoney1 = jsonObject.getString("siteMoney");
infoStr += "场地费:" + (StringUtils.isBlank(siteMoney1) ? "0":siteMoney1) + "\n";
String facilityMoney1 = jsonObject.getString("facilityMoney");
infoStr += "设备费:" + (StringUtils.isBlank(facilityMoney1) ? "0":facilityMoney1) + "\n";
//String administratorMoney1 = jsonObject.getString("administratorMoney");
//infoStr += "商业管理费:" + (StringUtils.isBlank(administratorMoney1) ? "0":administratorMoney1);

}
return infoStr;
}
@Override
public Integer getBillType() {
return EnumBillAllType.RENT.getCode();
}
@Override
public String getBillTypeName() {
return EnumBillAllType.RENT.getMessage();
}
@Override
public String getBillRemark() {
return "";
}
@Override
public String getReturnPay() {
return "0";
}
// @io.swagger.annotations.ApiModelProperty(value = "合同应收明细", name = "rentPriceInfo")
// private String rentPriceInfo;
//
// @Excel(name = "原合同应收金额明细(元)", width = 20, height = 30, orderNum = "7")
// @TableField(exist = false)
// private String rentPriceInfoStr;
// public String getRentPriceInfoStr() {
// String infoStr = "";
// if(StringUtils.isNotBlank(this.getRentPriceInfo())){
// JSONObject jsonObject = JSONObject.parseObject(this.getRentPriceInfo());
// String rentPrice1 = jsonObject.getString("rentPrice");
// infoStr += "租金:" + (StringUtils.isBlank(rentPrice1) ? "0":rentPrice1) + "\n";
// String siteMoney1 = jsonObject.getString("siteMoney");
// infoStr += "场地费:" + (StringUtils.isBlank(siteMoney1) ? "0":siteMoney1) + "\n";
// String facilityMoney1 = jsonObject.getString("facilityMoney");
// infoStr += "设备费:" + (StringUtils.isBlank(facilityMoney1) ? "0":facilityMoney1) + "\n";
// //String administratorMoney1 = jsonObject.getString("administratorMoney");
// //infoStr += "商业管理费:" + (StringUtils.isBlank(administratorMoney1) ? "0":administratorMoney1);
//
// }
// return infoStr;
// }
@Override
public String getBillLatePay() {
return latePayPrice;
}
//
// @Override
// public String getBillRemark() {
// return "";
// }
//
// @Override
// public String getReturnPay() {
// return "0";
// }
//
// @Override
// public String getBillLatePay() {
// return latePayPrice;
// }
@Override
public String getBillServicePay() {
return serviceChargePay;
}

@io.swagger.annotations.ApiModelProperty(value="商业管理费应收金额",name="bussinessManageFeeNeedPay")
private String bussinessManageFeeNeedPay;
@io.swagger.annotations.ApiModelProperty(value="运营管理费应收金额",name="operatingManageFeeNeedPay")
private String operatingManageFeeNeedPay;

@io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId")
private Long userId;

@io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId")
private Long shopId;

@io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue")
private String revenue;
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }

@io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio")
private Integer latePayRatio;
// @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId")
// private Long userId;

@io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime")
private Date latePayTime;
// @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue")
// private String revenue;

@io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice")
private String latePayPrice;
// @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio")
// private Integer latePayRatio;
//
// @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime")
// private Date latePayTime;
//
// @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice")
// private String latePayPrice;

// public String getLatePayPriceStr() {
// return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString();
// }

@Excel(name = "滞纳金(元)", width = 20, orderNum = "12")
@TableField(exist = false)
private String latePayPriceStr;

@SortColumn(column = "period")
@io.swagger.annotations.ApiModelProperty(value = "账期", name = "period")
private Integer period;

@io.swagger.annotations.ApiModelProperty(value = "预览账单0否1是", name = "isPreview")
private Integer isPreview;

@io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo")
private String shopInfo;

@io.swagger.annotations.ApiModelProperty(value = "滞纳金状态", name = "latePayStatus")
private Integer latePayStatus;

@io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments")
private String comments;

@TableField(exist = false)
private Integer allPeriod;

//@Excel(name = "押金状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6", "无押金_0"}, width = 20, orderNum = "3")
@TableField(exist = false)
private Integer depositStatus;

@TableField(exist = false)
private Integer rentType;

@TableField(exist = false)
private String deposit;

@io.swagger.annotations.ApiModelProperty(value = "联营费率", name = "payRatio")
private String payRatio;

@TableField(exist = false)
private Integer limitStart;
@TableField(exist = false)
private Integer limitEnd;

@io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio")
@TableField(exist = false)
private Integer latePayDay;

@TableField(exist = false)
private String latePayMoneyBefore;
@TableField(exist = false)
private String latePayMoneyUpdate;
private String busDiscountRatio;

@io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze")
private Integer freeze;

@io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice")
private String joinRentPrice;

@TableField(exist = false)
private String serviceChargePayBefore;
@TableField(exist = false)
private String serviceChargePayUpdate;

@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
private String serviceChargePay;

@TableField(exist = false)
private List<Long> rentContractIdList;

@TableField(exist = false)
private String totalFee;
public void calcuteTotalFee(Integer decimalSize) {
this.totalFee = new BigDecimal(this.receivePay).add(new BigDecimal(bussinessManageFeeNeedPay)).add(new BigDecimal(operatingManageFeeNeedPay))
.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString();
}
// @Excel(name = "滞纳金(元)", width = 20, orderNum = "12")
// @TableField(exist = false)
// private String latePayPriceStr;

// @io.swagger.annotations.ApiModelProperty(value = "滞纳金状态", name = "latePayStatus")
// private Integer latePayStatus;

// @io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments")
// private String comments;

// @TableField(exist = false)
// private Integer allPeriod;
//
// //@Excel(name = "押金状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6", "无押金_0"}, width = 20, orderNum = "3")
// @TableField(exist = false)
// private Integer depositStatus;
//
// @TableField(exist = false)
// private Integer rentType;
//
// @TableField(exist = false)
// private String deposit;
//
//// @io.swagger.annotations.ApiModelProperty(value = "联营费率", name = "payRatio")
//// private String payRatio;
//
// @TableField(exist = false)
// private Integer limitStart;
// @TableField(exist = false)
// private Integer limitEnd;
//
// @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio")
// @TableField(exist = false)
// private Integer latePayDay;
//
// @TableField(exist = false)
// private String latePayMoneyBefore;
// @TableField(exist = false)
// private String latePayMoneyUpdate;
//// private String busDiscountRatio;
//
//// @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze")
//// private Integer freeze;
//
//// @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice")
//// private String joinRentPrice;
//
// @TableField(exist = false)
// private String serviceChargePayBefore;
// @TableField(exist = false)
// private String serviceChargePayUpdate;
//
//// @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
//// private String serviceChargePay;
//
// @TableField(exist = false)
// private List<Long> rentContractIdList;
//
}

+ 28
- 52
mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java Прегледај датотеку

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;
import com.iformall.enums.EnumRentContractManageFeeType;
import com.iformall.utils.Constant;
@@ -25,14 +24,11 @@ import java.util.List;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxBillRentManage extends WxBillBaseEntity {
public class WxBillRentManage extends WxAllBill {

@io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId")
private Long rentContractId;

@io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay")
private String needPay;
//@Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "13")
@io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate")
private Date receiveDate;
@@ -109,23 +105,23 @@ public class WxBillRentManage extends WxBillBaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
private String serviceChargePay;

@io.swagger.annotations.ApiModelProperty(value="管理费类型,EnumRentContractManageFeeType",name="manageFeeType")
private Integer manageFeeType;
// @io.swagger.annotations.ApiModelProperty(value="管理费类型,EnumRentContractManageFeeType",name="manageFeeType")
// private Integer manageFeeType;
public void initByBillRent(WxBillRent billRent) {
this.rentContractId = billRent.getRentContractId();
this.pay = billRent.getPay();
this.starttime = billRent.getStarttime();
this.endtime = billRent.getEndtime();
this.receiveDate = billRent.getReceiveDate();
//this.receiveDate = billRent.getReceiveDate();
//截止收租日在当前时间之前
Date date = new Date();
this.updateTenantInfo(billRent);
this.isDel = billRent.getIsDel();
//this.isDel = billRent.getIsDel();
this.isPreview = billRent.getIsPreview();
this.merchantId = billRent.getMerchantId();
this.userId = billRent.getUserId();
this.shopId = billRent.getShopId();
//this.userId = billRent.getUserId();
//this.shopId = billRent.getShopId();
this.createtime = billRent.getCreatetime();
this.createBy = billRent.getCreateBy();
this.createByName = billRent.getCreateByName();
@@ -133,50 +129,30 @@ public class WxBillRentManage extends WxBillBaseEntity {
this.updateBy = billRent.getUpdateBy();
this.updateByName = billRent.getUpdateByName();
this.rentShopType = billRent.getRentShopType();
this.period = billRent.getPeriod();
this.shopInfo = billRent.getShopInfo();
this.latePayRatio = billRent.getLatePayRatio();
}
@Override
public Integer getBillType() {
if (this.manageFeeType == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()) {
return EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode();
}else if (this.manageFeeType == EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()) {
return EnumBillAllType.RENT_OPERATION_MANAGE.getCode();
}
return Constant.bill_all_type_manage_fee;
}
@Override
public String getBillTypeName() {
if (this.manageFeeType == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()) {
return EnumBillAllType.RENT_BUSSINESS_MANAGE.getMessage();
}else if (this.manageFeeType == EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()) {
return EnumBillAllType.RENT_OPERATION_MANAGE.getMessage();
}
return "商业&运营管理费";
}
@Override
public String getBillRemark() {
return "";
//this.period = billRent.getPeriod();
//this.shopInfo = billRent.getShopInfo();
//this.latePayRatio = billRent.getLatePayRatio();
}
@Override
public String getReturnPay() {
return "0";
}
@Override
public String getBillLatePay() {
return latePayPrice;
}
// @Override
// public String getBillRemark() {
// return "";
// }
//
// @Override
// public String getReturnPay() {
// return "0";
// }
//
// @Override
// public String getBillLatePay() {
// return latePayPrice;
// }
@Override
public String getBillServicePay() {
return serviceChargePay;
}
// @Override
// public String getBillServicePay() {
// return serviceChargePay;
// }
@TableField(exist = false)
private List<Long> merchantIds;


+ 1
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceive.java Прегледај датотеку

@@ -4,7 +4,6 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumFinanceReceiveStatus;
import com.iformall.enums.EnumFinanceReceiveType;

@@ -125,7 +124,7 @@ public class WxFinanceReceive extends TenantEntity {
private Integer isPrint;
@TableField(exist = false)
private List<WxBillBaseEntity> bills;
private List<WxAllBill> bills;
@TableField(exist = false)
private List<WxBillPayWay> payWays;


+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java Прегледај датотеку

@@ -475,4 +475,7 @@ public class WxMerchant extends TenantEntity {
@TableField(exist = false)
public Integer onlyOweOrNear;
@TableField(exist = false)
public Integer billType;
}

+ 8
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java Прегледај датотеку

@@ -7,6 +7,7 @@ import java.math.RoundingMode;
import java.util.Date;

import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.iformall.enums.EnumBillAllType;

@Data
public class WxBillHotNotify implements Serializable {
@@ -30,5 +31,12 @@ public class WxBillHotNotify implements Serializable {
return totalMoneyNumber;
}
public String getBillTypeName() {
if (null != billType) {
return EnumBillAllType.getEnum(billType).getMessage();
}
return null;
}
}

+ 8
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxBillNotify.java Прегледај датотеку

@@ -7,6 +7,7 @@ import java.math.RoundingMode;
import java.util.Date;

import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.iformall.enums.EnumBillAllType;

@Data
public class WxBillNotify implements Serializable {
@@ -30,4 +31,11 @@ public class WxBillNotify implements Serializable {
public String getOwe() {
return new BigDecimal(receivePay).subtract(new BigDecimal(pay)).toPlainString();
}
public String getBillTypeName() {
if (null != billType) {
return EnumBillAllType.getEnum(billType).getMessage();
}
return null;
}
}

+ 35
- 21
mallinkService/src/main/java/com/iformall/domain/vo/WxBillSum.java Прегледај датотеку

@@ -33,19 +33,24 @@ public class WxBillSum implements Serializable {

//手续费
private String servicePay = "0";
@TableField(exist = false)
private BigDecimal servicePayNumber;
//@TableField(exist = false)
//private BigDecimal servicePayNumber;
//滞纳金
private String latePay = "0";
@TableField(exist = false)
private BigDecimal latePayNumber;
//@TableField(exist = false)
//private BigDecimal latePayNumber;
//已退回金额
private String returnPay = "0";
@TableField(exist = false)
private BigDecimal returnPayNumber;
//冲抵金额
private String setOff = "0";
@TableField(exist = false)
private BigDecimal setOffNumber;
public BigDecimal getNeedPayNumber() {
if (StringUtils.isNotBlank(needPay)) {
this.needPayNumber = new BigDecimal(needPay);
@@ -83,23 +88,23 @@ public class WxBillSum implements Serializable {
return oweNumber;
}
public BigDecimal getServicePayNumber() {
if (StringUtils.isNotBlank(servicePay)) {
this.servicePayNumber = new BigDecimal(servicePay);
}else {
this.servicePayNumber = new BigDecimal(0);
}
return servicePayNumber;
}
public BigDecimal getLatePayNumber() {
if (StringUtils.isNotBlank(latePay)) {
this.latePayNumber = new BigDecimal(latePay);
}else {
this.latePayNumber = new BigDecimal(0);
}
return latePayNumber;
}
// public BigDecimal getServicePayNumber() {
// if (StringUtils.isNotBlank(servicePay)) {
// this.servicePayNumber = new BigDecimal(servicePay);
// }else {
// this.servicePayNumber = new BigDecimal(0);
// }
// return servicePayNumber;
// }
//
// public BigDecimal getLatePayNumber() {
// if (StringUtils.isNotBlank(latePay)) {
// this.latePayNumber = new BigDecimal(latePay);
// }else {
// this.latePayNumber = new BigDecimal(0);
// }
// return latePayNumber;
// }
public BigDecimal getNeedReturnNumber() {
if (StringUtils.isNotBlank(returnPay)) {
@@ -110,6 +115,15 @@ public class WxBillSum implements Serializable {
return returnPayNumber;
}
public BigDecimal getsetOffNumber() {
if (StringUtils.isNotBlank(setOff)) {
this.setOffNumber = new BigDecimal(setOff);
}else {
this.setOffNumber = new BigDecimal(0);
}
return setOffNumber;
}
@TableField(exist = false)
private String billName;
@TableField(exist = false)


+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/vo/WxFinanceReceiveVo.java Прегледај датотеку

@@ -4,10 +4,10 @@ import cn.afterturn.easypoi.excel.annotation.Excel;

import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.annotation.TableField;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxFinanceReceive;
import com.iformall.domain.po.WxFinanceReceiveBill;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;
import com.iformall.enums.EnumFinanceReceiveStatus;
import com.iformall.enums.EnumFinanceReceiveType;


+ 2
- 2
mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java Прегледај датотеку

@@ -9,9 +9,9 @@ public enum EnumBillAllType {
RENT_BUSSINESS_MANAGE(11,"商业管理费",2L,false),
RENT_OPERATION_MANAGE(12,"运营管理费",3L,false),
RENT_DEPOSIT(13,"租赁押金",null,true),
PROPERTY(2,"物业",5L,false),
PROPERTY(2,"物业",5L,false),
PROPERTY_DEPOSIT(21,"物业押金",6L,true),
DAILY(3, "日常(水电空调)费",null,false),
DAILY(3, "能耗(水电空调)费",null,false),
OTHER(4, "其他费用",null,false),
OTHER_DEPOSIT(5, "其他押金",null,true),
ADVANCE(6,"预收",null,true)


+ 39
- 0
mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java Прегледај датотеку

@@ -0,0 +1,39 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.vo.WxBillHotNotify;
import com.iformall.domain.vo.WxBillNotify;
import com.iformall.domain.vo.WxBillSum;
import org.apache.ibatis.annotations.Param;
import java.util.List;

/**
*/
public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> {

List<WxAllBill> findList(WxAllBill wxBillRent);
List<Long> queryBillRentContractIdList(WxAllBill record);
List<WxBillNotify> getBillNotifyList(WxAllBill record);

void deleteBillByContract(WxRentContract wxRentContract);
void deletePreviewBill(WxAllBill wxBillRent);
void deleteNoNeedPayBill(WxAllBill wxBillRent);
void updatePreviewStatus(WxAllBill record);

void insertBills(@Param("tenantId")String tenantId, @Param("list")List<WxAllBill> resultList);

WxBillSum getBillMonthSum(WxAllBill wxBillRent);
List<Long> getMerchantIdList(WxAllBill wxBillRent);
List<WxBillHotNotify> getBillHotNotify(WxAllBill wxBillRent);
WxAllBill selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);

}

+ 72
- 0
mallinkService/src/main/java/com/iformall/service/WxAllBillService.java Прегледај датотеку

@@ -0,0 +1,72 @@
package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxBillPayDTO;
import com.iformall.domain.dto.WxBillReceiveUpdateDTO;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillRent;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPropertyContract;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxBillHotNotify;
import com.iformall.domain.vo.WxBillNotify;
import com.iformall.domain.vo.WxBillSum;
import com.iformall.enums.EnumBillAction;
import com.iformall.enums.EnumBillStatus;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*/
public interface WxAllBillService {

WxBillSum getBillMonthSum(WxAllBill wxBillRent);
PageInfo<WxAllBill> listAsPage(WxAllBill record, Integer pageIndex, Integer pageSize);
List<Long> getMerchantIds(WxAllBill wxBillRent);
List<WxBillHotNotify> getBillHotNotify(WxAllBill wxBillRent);
WxAllBill getById(TenantEntity tenantEntity,Long id);
void notify(WxBillPayDTO dto,MallUserInfo user);
void updateReceivePay(WxBillReceiveUpdateDTO dto,MallUserInfo user,boolean forcePaid);
void updatePay(WxBillPayDTO dto,MallUserInfo user);
void updatePayByMerchant(WxBillPayDTO dto,WxMerchantBUser user,boolean isOnline);
void returnDeposit(WxBillPayDTO dto, MallUserInfo user);
void bad(WxBillPayDTO dto,MallUserInfo user);
void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user);
List<WxAllBill> list(WxAllBill record);
List<WxBillNotify> notifyList(WxAllBill record);
void backPay(WxBillPayDTO dto,MallUserInfo user);
void rentContractStop(WxRentContract rentContract,MallUserInfo user);
void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user);
void stopMerchantBills(WxMerchant wxMerchant,MallUserInfo userInfo);
ResultData saveOrUpdate(WxAllBill record, MallUserInfo user);


ResultData updateRevenue(WxAllBill wxBillRent, MallUserInfo user);

void exportBill(HttpServletRequest request, HttpServletResponse response, WxAllBill wxBillRent);

}

+ 3
- 3
mallinkService/src/main/java/com/iformall/service/WxFinanceService.java Прегледај датотеку

@@ -5,12 +5,12 @@ import java.util.Map;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.dto.FinanceSetOffDTO;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxFinanceReceive;
import com.iformall.domain.po.WxFinanceReceiveBill;
import com.iformall.domain.po.WxFinanceReceiveSetoff;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.domain.vo.FinanceBillSetoffSum;
import com.iformall.domain.vo.WxFinanceReceiveVo;
/**
@@ -27,13 +27,13 @@ public interface WxFinanceService {
//收款
PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize);
List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user);
List<WxAllBill> createReceive(WxFinanceReceive record,MallUserInfo user);
WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id);
void invalidReceive(WxFinanceReceive record,MallUserInfo user,String remark);
void redSetoffReceive(WxFinanceReceive record,MallUserInfo user);
void finishReceive(WxFinanceReceive record,MallUserInfo user);
//预收款
List<WxBillBaseEntity> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user);
List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user);
FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record);
List<WxFinanceReceive> getSetOffList(FinanceSetOffDTO dto,boolean isMerge);
void createAdvance(WxFinanceReceive record,MallUserInfo user);


+ 76
- 816
mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 741
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java Прегледај датотеку

@@ -0,0 +1,741 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxBillPayDTO;
import com.iformall.domain.dto.WxBillReceiveUpdateDTO;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillAction;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPropertyContract;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.RatioVo;
import com.iformall.domain.vo.WxBillHotNotify;
import com.iformall.domain.vo.WxBillNotify;
import com.iformall.domain.vo.WxBillSum;
import com.iformall.enums.EnumBillAction;
import com.iformall.enums.EnumBillStatus;
import com.iformall.enums.EnumBusRatioTime;
import com.iformall.enums.EnumDelStatus;
import com.iformall.enums.EnumGetRatioFrom;
import com.iformall.enums.EnumMissTimeType;
import com.iformall.enums.EnumRentContractType;
import com.iformall.enums.EnumRentShopType;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxAllBillMapper;
import com.iformall.mapper.WxBillActionMapper;
import com.iformall.mapper.WxBillDepositMapper;
import com.iformall.mapper.WxBillRentManageMapper;
import com.iformall.mapper.WxBillRentMapper;
import com.iformall.mapper.WxRentContractMapper;
import com.iformall.service.ExcelService;
import com.iformall.service.WxAllBillService;
import com.iformall.service.WxBillActionService;
import com.iformall.service.WxBillDepositService;
import com.iformall.service.WxBillRentService;
import com.iformall.service.WxFinanceService;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxMerchantTradeDailyService;
import com.iformall.service.WxPayAccountBillService;
import com.iformall.service.helper.WxBillAllHelper;
import com.iformall.utils.Constant;
import com.iformall.utils.DateUtils;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Months;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

/**
*/
@Service
public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBillService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxAllBillMapper wxAllBillMapper;
@Lazy
@Autowired
WxBillActionService wxBillActionService;
@Autowired
ExcelService excelService;
@Lazy
@Autowired
WxMerchantTradeDailyService wxMerchantTradeDailyService;
@Lazy
@Autowired
WxPayAccountBillService wxPayAccountBillService;
@Lazy
@Autowired
WxMerchantService wxMerchantService;
@Lazy
@Autowired
WxBillAllHelper wxBillAllHelper;
@Lazy
@Autowired
WxFinanceService wxFinanceService;
@Autowired
WxRentContractMapper wxRentContractMapper;

private void updateQueryParam(WxAllBill wxBillRent) {
if (null != wxBillRent.getFloorForRule() || null != wxBillRent.getFloor() || null != wxBillRent.getBuilding()) {
List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRent, wxBillRent.getFloorForRule(), wxBillRent.getBuilding(), wxBillRent.getFloor(), 0, 0);
if (null != merchantIds) {
wxBillRent.setMerchantIdList(merchantIds);
}else {
wxBillRent.setId(-1L);
}
}
if (StringUtils.isNotBlank(wxBillRent.getMerchantName())) {
WxMerchant mq = new WxMerchant();
mq.updateTenantInfo(wxBillRent);
mq.setName(StringUtils.trimToNull(wxBillRent.getMerchantName()));
List<Long> mids = wxMerchantService.findIdList(mq);
if (null != mids && mids.size() > 0 ) {
if (null != wxBillRent.getMerchantIdList()) {
List<Long> _mids = (List<Long>) CollectionUtils.intersection(mids, wxBillRent.getMerchantIdList());
if (null == _mids || _mids.size() <= 0) {
wxBillRent.setId(-1L);
}else {
wxBillRent.setMerchantIdList(_mids);
}
}else {
wxBillRent.setMerchantIdList(mids);
}
}else {
wxBillRent.setId(-1L);
}
}
}
@Override
public WxBillSum getBillMonthSum(WxAllBill wxBillRent) {
updateQueryParam(wxBillRent);
return wxAllBillMapper.getBillMonthSum(wxBillRent);
}
@Override
public PageInfo<WxAllBill> listAsPage(WxAllBill record, Integer pageIndex, Integer pageSize) {
updateQueryParam(record);
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxAllBillMapper.findList(record));
}
@Override
public List<Long> getMerchantIds(WxAllBill wxBillRent) {
updateQueryParam(wxBillRent);
return wxAllBillMapper.getMerchantIdList(wxBillRent);
}
@Override
public List<WxBillHotNotify> getBillHotNotify(WxAllBill wxBillRent) {
updateQueryParam(wxBillRent);
return wxAllBillMapper.getBillHotNotify(wxBillRent);
}
@Override
public WxAllBill getById(TenantEntity tenantEntity,Long id) {
return wxAllBillMapper.selectById(id, tenantEntity.getTenantId());
}
@Override
public void notify(WxBillPayDTO dto, MallUserInfo user) {
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
wxBillRent.setUpdateBy(user.getId());
wxBillRent.setUpdateByName(user.getName());
wxBillRent.setLastOweCallTime(new Date());
wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")");
wxAllBillMapper.updateById(wxBillRent);
this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(),
null, null,null,null,null,dto.getRemark(),null,null, user);
}
@Override
public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) {
WxAllBill dbBill = wxAllBillMapper.selectById(dto.getId(),dto.getTenantId());
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
wxBillRent.setUpdateBy(user.getId());
wxBillRent.setUpdateByName(user.getName());
if (forcePaid) {
wxBillRent.setReceivePay(dbBill.getPay());
wxBillRent.setStatus(EnumBillStatus.PAID.getCode());
wxAllBillMapper.updateById(wxBillRent);
String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。";
this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), dbBill.getPay(), dbBill.getPay(),null,null,null,remark,null,null, user);
}else {
if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) {
wxBillRent.setBillLatePay(dto.getNewLatePrice());
wxAllBillMapper.updateById(wxBillRent);
this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(),
dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,null,dto.getRemark(),null,null, user);
}else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) {
wxBillRent.setServiceChargePay(dto.getServiceChargePayUpdate());
wxAllBillMapper.updateById(wxBillRent);
this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(),
dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,null,null,dto.getRemark(),null,null, user);
}else {
//租赁账单更新
wxBillRent.setReceivePay(dto.getNewPrice());
Date payDate = null;
WxBillPayWay payWay = null;
String remark = StringUtils.trimToEmpty(dto.getRemark());
if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) {
wxBillRent.setStatus(EnumBillStatus.PAID.getCode());
payDate = new Date();
payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system);
remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。";
}
wxAllBillMapper.updateById(wxBillRent);
//账单日志
this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(),
dto.getOldPrice(), dto.getNewPrice(),null,payDate,payWay,remark,null,null, user);
}
}
}
@Override
public void updatePay(WxBillPayDTO dto, MallUserInfo user) {
WxAllBill wxBillRent = updateBillPay(dto);
EnumBillAction action = EnumBillAction.OFFLINE_PAY;
this.addBillAction(action, dto.getBillTypeValue(),dto.getId(),
dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user);
}
private WxAllBill updateBillPay(WxBillPayDTO dto) {
WxAllBill dbBill = wxAllBillMapper.selectById(dto.getId(),dto.getTenantId());
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
BigDecimal opay = new BigDecimal(0);
if (StringUtils.isNotBlank(dbBill.getPay())) {
opay = new BigDecimal(dbBill.getPay());
}
//支付的金额先扣除手续费和滞纳金,多余的再抵扣本金
String servicePay = dbBill.getServiceChargePay();
if (StringUtils.isBlank(servicePay)) {
servicePay = "0";
}
StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark()));
BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay));
if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) {
if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) {
wxBillRent.setServiceChargePay("0");
sb.append(";手续费").append(servicePay).append("已结清");
}else {
wxBillRent.setServiceChargePay(dto.getAddpay());
sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay());
}
}
BigDecimal latePayLastMoney = new BigDecimal(0);
if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) {
String latePay = dbBill.getBillLatePay();
if (StringUtils.isBlank(latePay)) {
latePay = "0";
}
latePayLastMoney = serviceLastMoney.subtract(new BigDecimal(latePay));
if (new BigDecimal(latePay).compareTo(new BigDecimal(0)) > 0 ) {
if (latePayLastMoney.compareTo(new BigDecimal(0)) >= 0 ) {
wxBillRent.setBillLatePay("0");
sb.append(";滞纳金").append(latePay).append("已结清");
}else {
String lp = new BigDecimal(latePay).subtract(serviceLastMoney).toPlainString();
wxBillRent.setBillLatePay(lp);
sb.append(";滞纳金").append(latePay).append("已支付").append(lp);
}
}
}
if (latePayLastMoney.compareTo(new BigDecimal(0)) > 0 ) {
opay = opay.add(latePayLastMoney);
wxBillRent.setPay(opay.toPlainString());
//如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注
if (new BigDecimal(dto.getAddpay()).compareTo(latePayLastMoney) > 0 ) {
sb.append(";已付金额增加").append(latePayLastMoney.toPlainString());
}
if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) {
wxBillRent.setStatus(EnumBillStatus.PAID.getCode());
sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。");
}
}
String oldSetOff = dbBill.getSetOff();
if (StringUtils.isBlank(oldSetOff)) {
oldSetOff = "0";
}
wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString());
wxBillRent.setPayDate(new Date());
wxBillRent.setPayWay(dto.getPayWayObject().getId());
wxAllBillMapper.updateById(wxBillRent);
dto.setRemark(sb.toString());
return wxBillRent;
}

@Override
public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) {
WxAllBill wxBillRent = updateBillPay(dto);
EnumBillAction action = null;
if (isOnline) {
action = EnumBillAction.SELF_SERVICE_PAY;
}else {
action = EnumBillAction.OFFLINE_PAY;
}
this.addBillAction(action, dto.getBillTypeValue(),dto.getId(),
dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user);
}
@Override
public void returnDeposit(WxBillPayDTO dto, MallUserInfo user) {
WxAllBill dbBill = wxAllBillMapper.selectById(dto.getId(),dto.getTenantId());
BigDecimal oldpay = new BigDecimal(0);
if (StringUtils.isNotBlank(dbBill.getReturnPay())) {
oldpay = new BigDecimal(dbBill.getReturnPay());
}
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
wxBillRent.setReturnPay(oldpay.add(new BigDecimal(dto.getAddpay())).toPlainString());
wxAllBillMapper.updateById(wxBillRent);
this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(),
dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user);
}
@Override
public void bad(WxBillPayDTO dto, MallUserInfo user) {
WxAllBill dbBill = wxAllBillMapper.selectById(dto.getId(),dto.getTenantId());
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
wxBillRent.setUpdateBy(user.getId());
wxBillRent.setUpdateByName(user.getName());
wxBillRent.setStatus(EnumBillStatus.BAD.getCode());
wxAllBillMapper.updateById(wxBillRent);
String badMoney = dbBill.getOwe();
this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(),
badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user);
}
@Override
public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) {
WxAllBill bill = new WxAllBill();
bill.updateTenantInfo(wxMerchant);
bill.setFloorForRule(wxMerchant.getFloorForRule());
bill.setBusinessForRule(wxMerchant.getBusinessForRule());
bill.setBuilding(wxMerchant.getBuilding());
bill.setFloor(wxMerchant.getFloor());
bill.setMerchantId(wxMerchant.getId());
bill.setStatus(status.getCode());
updateQueryParam(bill);
PageInfo<WxAllBill> bpage = this.listAsPage(bill, 1, 100);
if (null != bpage && null != bpage.getList()) {
for (int i = 0 ; i < bpage.getList().size() ; i++ ) {
WxAllBill b = bpage.getList().get(i);
WxAllBill bu = new WxAllBill();
bu.setId(b.getId());
bu.updateTenantInfo(b);
bu.setStatus(EnumBillStatus.INVALID.getCode());
bu.setUpdatetime(new Date());
bu.setUpdateBy(user.getId());
bu.setUpdateByName(user.getName());
wxAllBillMapper.updateById(bu);
WxBillAction wxBillAction = new WxBillAction();
wxBillAction.setBillId(b.getId());
wxBillAction.setBillType(b.getBillType());
wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode());
wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID));
wxBillAction.setRemark(wxMerchant.getBillCompleteRemark());
this.addBillAction(wxBillAction, user);
}
}
}
@Override
public List<WxAllBill> list(WxAllBill record) {
updateQueryParam(record);
return wxAllBillMapper.findList(record);
}
@Override
public List<WxBillNotify> notifyList(WxAllBill record) {
updateQueryParam(record);
return wxAllBillMapper.getBillNotifyList(record);
}
@Override
public void backPay(WxBillPayDTO dto, MallUserInfo user) {
WxAllBill dbBill = wxAllBillMapper.selectById(dto.getId(),dto.getTenantId());
BigDecimal oldpay = new BigDecimal(0);
if (StringUtils.isNotBlank(dbBill.getPay())) {
oldpay = new BigDecimal(dbBill.getPay());
}
BigDecimal oldsetoff = new BigDecimal(0);
if (StringUtils.isNotBlank(dbBill.getSetOff())) {
oldsetoff = new BigDecimal(dbBill.getSetOff());
}
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString());
wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString());
if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) {
if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) {
wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode());
}
}
wxAllBillMapper.updateById(wxBillRent);
EnumBillAction action = EnumBillAction.RETURN;
this.addBillAction(action, dto.getBillTypeValue(),dto.getId(),
dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user);
}
@Override
public void rentContractStop(WxRentContract rentContract,MallUserInfo user) {
//删除草稿状态的账单
WxAllBill brDel = new WxAllBill();
brDel.setRentContractId(rentContract.getId());
brDel.updateTenantInfo(rentContract);
brDel.setIsPreview(EnumYesOrNo.YES.getCode());
wxAllBillMapper.deletePreviewBill(brDel);
//删除还未到期的账单
brDel.setShopEndtime(rentContract.getEndContractTime());
wxAllBillMapper.deleteNoNeedPayBill(brDel);
WxAllBill br = new WxAllBill();
br.setRentContractId(rentContract.getId());
br.updateTenantInfo(rentContract);
br.setIsPreview(EnumYesOrNo.NO.getCode());
List<WxAllBill> brList = wxAllBillMapper.findList(br);
List<WxAllBill> realRentList = new ArrayList<WxAllBill>();
List<WxBillAction> actionList = new ArrayList<WxBillAction>();
if (null != brList && brList.size() > 0 ) {
for (int i = 0 ; i < brList.size() ; i ++ ) {
WxAllBill brent = brList.get(i);
WxBillAction action = new WxBillAction();
boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, false);
if (isUpdate) {
realRentList.add(brent);
actionList.add(action);
}
}
}
for (int i = 0 ; i < realRentList.size() ; i ++) {
WxAllBill rbrent = realRentList.get(i);
wxAllBillMapper.updateById(rbrent);
}
for (int i = 0 ; i < actionList.size() ; i ++) {
WxBillAction ba = actionList.get(i);
this.addBillAction(ba, user);
}
}
@Override
public void propertyContractStop(WxPropertyContract propertyContract, MallUserInfo user) {
WxAllBill brDel = new WxAllBill();
brDel.setPropertyContractId(propertyContract.getId());
brDel.setIsPreview(EnumYesOrNo.YES.getCode());
brDel.updateTenantInfo(propertyContract);
wxAllBillMapper.deletePreviewBill(brDel);
brDel.setShopEndtime(propertyContract.getEndContractTime());
wxAllBillMapper.deleteNoNeedPayBill(brDel);
WxAllBill br = new WxAllBill();
br.setPropertyContractId(propertyContract.getId());
br.setIsPreview(EnumYesOrNo.NO.getCode());
br.updateTenantInfo(propertyContract);
List<WxAllBill> brList = wxAllBillMapper.findList(br);
List<WxAllBill> realRentList = new ArrayList<WxAllBill>();
List<WxBillAction> actionList = new ArrayList<WxBillAction>();
if (null != brList && brList.size() > 0 ) {
for (int i = 0 ; i < brList.size() ; i ++ ) {
WxAllBill brent = brList.get(i);
WxBillAction action = new WxBillAction();
boolean isUpdate = wxBillAllHelper.billEndCalcute(propertyContract.getDecimalSize() ,propertyContract.getEndContractTime(), brent, action, false);
if (isUpdate) {
realRentList.add(brent);
actionList.add(action);
}
}
}
for (int i = 0 ; i < realRentList.size() ; i ++) {
WxAllBill rbrent = realRentList.get(i);
wxAllBillMapper.updateById(rbrent);
}
for (int i = 0 ; i < actionList.size() ; i ++) {
WxBillAction ba = actionList.get(i);
this.addBillAction(ba, user);
}
}
@Override
public void stopMerchantBills(WxMerchant wxMerchant, MallUserInfo userInfo) {
WxAllBill ddel = new WxAllBill();
ddel.setMerchantId(wxMerchant.getId());
ddel.updateTenantInfo(wxMerchant);
ddel.setShopEndtime(new Date());
wxAllBillMapper.deleteNoNeedPayBill(ddel);
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setMerchantId(wxMerchant.getId());
wxBillRent.updateTenantInfo(wxMerchant);
List<WxAllBill> brList = wxAllBillMapper.findList(wxBillRent);
List<WxAllBill> realRentList = new ArrayList<WxAllBill>();
List<WxBillAction> actionList = new ArrayList<WxBillAction>();
Date current = DateUtils.getDayEnd(new Date());
if (null != brList && brList.size() > 0 ) {
for (int i = 0 ; i < brList.size() ; i ++ ) {
WxAllBill brent = brList.get(i);
WxBillAction action = new WxBillAction();
boolean isUpdate = wxBillAllHelper.billEndCalcute(2,current, brent, action, false);
if (isUpdate) {
realRentList.add(brent);
actionList.add(action);
}
}
}
for (int i = 0 ; i < realRentList.size() ; i ++) {
WxAllBill rbrent = realRentList.get(i);
wxAllBillMapper.updateById(rbrent);
}
for (int i = 0 ; i < actionList.size() ; i ++) {
WxBillAction ba = actionList.get(i);
this.addBillAction(ba, userInfo);
}
}
@Override
public ResultData saveOrUpdate(WxAllBill record, MallUserInfo user) {
//String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay();
String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay();
String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay();
if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){
return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额");
}
Date date = new Date();
if (record.getId() == null) {
logger.info("新增租赁账单");
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
record.setCreatetime(date);
record.setUpdatetime(date);
record.setUpdateBy(user.getId());
record.setUpdateByName(user.getName());
record.setCreateBy(user.getId());
record.setCreateByName(user.getName());
record.updateTenantInfo(user);
//record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString());
//record.setIsDel(EnumDelStatus.NOT_DEL.getCode());
try {
wxAllBillMapper.insert(record);
} catch (Exception e) {
logger.error("保存租赁账单失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
}
return new ResultData(Result.SUCCESS, "保存租赁账单成功");
} else {
return new ResultData();
}
}
public static int getMonths(String startStr,String endStr){
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
DateTime start = formatter.parseDateTime(startStr);
DateTime end = formatter.parseDateTime(endStr);
int months = Months.monthsBetween(start, end).getMonths();
return months;
}

@Override
@Transactional(rollbackFor = {Exception.class})
public ResultData updateRevenue(WxAllBill record, MallUserInfo user) {
WxAllBill wxBillRent = wxAllBillMapper.selectById(record.getId(),user.getTenantId());
WxRentContract wxRentContract = wxRentContractMapper.selectById(wxBillRent.getRentContractId());
SimpleDateFormat sdD = new SimpleDateFormat("d");
SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM");

int startInt = Integer.parseInt(sdD.format(wxBillRent.getStarttime()));
int endInt = Integer.parseInt(sdD.format(DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1)));
int months = getMonths(sdM.format(wxBillRent.getStarttime())+"-01",sdM.format(DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1))+"-01");

//wxBillRent.setRevenue(record.getRevenue());

String ratio = "0";
RatioVo ratioVo = null;
if(StringUtils.isNotBlank(wxRentContract.getPayRatio())){
ratio = wxRentContract.getPayRatio();
}else{
if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){
// long dayCount = DateUtils.startToEnd(wxBillRent.getStarttime(),wxBillRent.getEndtime()) + 1;
// if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){
// if(startInt == endInt && months == 12){
// //刚好1年
// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),
// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0,null);
// }else{
// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),
// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.YEAR.getCode(),dayCount,0,null);
// }
// }else if(EnumBusRatioTime.MONTH.getCode().equals(wxRentContract.getBusDiscountTime())){
// if(startInt == endInt && months == 1){
// //刚好1个月
// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),
// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0,null);
// }else{
// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),
// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.MONTH.getCode(),dayCount,0,null);
// }
// }else if(EnumBusRatioTime.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){
// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),
// EnumMissTimeType.PERIOD.getCode(),dayCount,wxRentContract.getReceivePeriod(),wxRentContract.getReceivePeriodUnit());
// }
}
}

String newReceivePay;
if(ratioVo != null){
newReceivePay = ratioVo.getPrice();
//wxBillRent.setPayRatio(ratioVo.getRatio().longValue());
//如果在跳点区间中,修改扣点率
if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){
//wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio());
}
}else{
//BigDecimal revenue = new BigDecimal(StringUtils.isBlank(record.getRevenue()) ? "0" : record.getRevenue());
BigDecimal revenue = new BigDecimal(0);
BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000));
BigDecimal price = revenue.multiply(payRatio).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN);
newReceivePay = price.toPlainString();
}
//wxBillRent.setJoinRentPrice(newReceivePay);
if(new BigDecimal(newReceivePay).compareTo(new BigDecimal(wxBillRent.getReceivePay())) > 0){
wxBillRent.setReceivePay(newReceivePay);
}

String oldPrice = wxBillRent.getReceivePay();
String newPrice = newReceivePay;
wxBillRent.setUpdatetime(new Date());
wxBillRent.setUpdateBy(user.getId());
wxBillRent.setUpdateByName(user.getName());
String latePayPrice = StringUtils.isBlank(wxBillRent.getBillLatePay()) ? "0" : wxBillRent.getBillLatePay();
//wxBillRent.setOwe(new BigDecimal(newPrice).add(new BigDecimal(wxBillRent.getServiceChargePay())).add(new BigDecimal(latePayPrice)).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString());
//wxBillRent.setOwe(new BigDecimal(newPrice).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString());
wxAllBillMapper.updateById(wxBillRent);

if (!oldPrice.equals(newPrice)) {
//日志
WxBillAction wxBillAction = new WxBillAction();
wxBillAction.updateTenantInfo(user);
wxBillAction.setBillId(wxBillRent.getId());
String oldPriceStr = new BigDecimal(oldPrice).divide(new BigDecimal(100)).toPlainString();
String newPriceStr = new BigDecimal(newPrice).divide(new BigDecimal(100)).toPlainString();
wxBillAction.setDetails("录入营业额时应收金额" + oldPriceStr + "元变更成" + newPriceStr + "元");
wxBillAction.setAction(EnumBillAction.UPDATE_BILL.getCode());
wxBillAction.setUserId(user.getId());
wxBillAction.setUserName(user.getName());
wxBillAction.setPhone(user.getPhone());
wxBillAction.updateTenantInfo(wxBillRent);
try {
wxBillActionService.save(wxBillAction);
} catch (Exception e) {
logger.error("添加租赁账单行为日志,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "修改营业额失败");
}
}
return new ResultData(Result.SUCCESS, "修改营业额成功", wxBillRent);
}

@Override
public void exportBill(HttpServletRequest request, HttpServletResponse response, WxAllBill wxBillRent) {
String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单";
PageInfo<WxAllBill> billRentList = listAsPage(wxBillRent,1,10000);
List<WxAllBill> datalist = new ArrayList<WxAllBill>();
if (null != billRentList && null != billRentList.getList()) {
Map<Long, List<WxAllBill>> collect = billRentList.getList().parallelStream()
.collect(Collectors.groupingBy(WxAllBill::getMerchantId));
Set<Map.Entry<Long, List<WxAllBill>>> entries = collect.entrySet();
for (Map.Entry<Long, List<WxAllBill>> entry : entries) {
List<WxAllBill> list = entry.getValue();
for (WxAllBill rent : list) {
//if (rent.getDepositStatus() == null) {
// rent.setDepositStatus(0);
//}
String shopNumber = rent.getShopNumber();
if (StringUtils.isEmpty(shopNumber)) {
String shopInfo = rent.getShopInfo();
if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) {
JSONObject jsonObject = JSONObject.parseObject(shopInfo);
StringBuffer sb = new StringBuffer();
Set<Map.Entry<String, Object>> sets = jsonObject.entrySet();
sets.forEach(x -> sb.append(x.getKey()).append(","));
if(StringUtils.isNotBlank(sb)){
rent.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString());
}
}
}
datalist.add(rent);
}
}
}
excelService.exportExcel(datalist, null, billName, WxAllBill.class, billName + ".xlsx", response, false);
}

}

+ 6
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java Прегледај датотеку

@@ -589,22 +589,7 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil
dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user);
}

@Override
public void returnDeposit(WxBillPayDTO dto, MallUserInfo user) {
WxBillDeposit dbBill = wxBillDepositMapper.selectById(dto.getId(),dto.getTenantId());
BigDecimal oldpay = new BigDecimal(0);
if (StringUtils.isNotBlank(dbBill.getReturnPrice())) {
oldpay = new BigDecimal(dbBill.getReturnPrice());
}
WxBillDeposit wxBillRent = new WxBillDeposit();
wxBillRent.setId(dto.getId());
wxBillRent.updateTenantInfo(dto);
wxBillRent.setUpdatetime(new Date());
wxBillRent.setReturnPrice(oldpay.add(new BigDecimal(dto.getAddpay())).toPlainString());
wxBillDepositMapper.updateById(wxBillRent);
this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(),
dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user);
}

@Override
public void bad(WxBillPayDTO dto, MallUserInfo user) {
@@ -691,4 +676,9 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil
}
}

@Override
public void returnDeposit(WxBillPayDTO dto, MallUserInfo user) {
}

}

+ 59
- 61
mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java Прегледај датотеку

@@ -137,16 +137,13 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe

public void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillRent rent) {
if (rent.getReceivePay() != null) {
if (rent.getLatePayPrice() == null) {
rent.setLatePayPrice("0");
}
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), decimalSize, BigDecimal.ROUND_HALF_UP);
}
BigDecimal realReceivePay = servicePay.add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getReceivePay()));
BigDecimal realReceivePay = servicePay.add(new BigDecimal(rent.getBillLatePay())).add(new BigDecimal(rent.getReceivePay()));
rent.setRealReceivePay(realReceivePay.toPlainString());
rent.setServiceChargePay(servicePay.toPlainString());
// if (!rent.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) {
@@ -234,7 +231,7 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
record.setCreateByName(user.getName());
record.updateTenantInfo(user);
//record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString());
record.setIsDel(EnumDelStatus.NOT_DEL.getCode());
//record.setIsDel(EnumDelStatus.NOT_DEL.getCode());
try {
wxBillRentMapper.insert(record);
} catch (Exception e) {
@@ -341,7 +338,7 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
int endInt = Integer.parseInt(sdD.format(DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1)));
int months = getMonths(sdM.format(wxBillRent.getStarttime())+"-01",sdM.format(DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1))+"-01");

wxBillRent.setRevenue(record.getRevenue());
//wxBillRent.setRevenue(record.getRevenue());

String ratio = "0";
RatioVo ratioVo = null;
@@ -381,15 +378,16 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
//wxBillRent.setPayRatio(ratioVo.getRatio().longValue());
//如果在跳点区间中,修改扣点率
if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){
wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio());
//wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio());
}
}else{
BigDecimal revenue = new BigDecimal(StringUtils.isBlank(record.getRevenue()) ? "0" : record.getRevenue());
//BigDecimal revenue = new BigDecimal(StringUtils.isBlank(record.getRevenue()) ? "0" : record.getRevenue());
BigDecimal revenue = new BigDecimal(0);
BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000));
BigDecimal price = revenue.multiply(payRatio).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN);
newReceivePay = price.toPlainString();
}
wxBillRent.setJoinRentPrice(newReceivePay);
//wxBillRent.setJoinRentPrice(newReceivePay);
if(new BigDecimal(newReceivePay).compareTo(new BigDecimal(wxBillRent.getReceivePay())) > 0){
wxBillRent.setReceivePay(newReceivePay);
}
@@ -399,7 +397,7 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
wxBillRent.setUpdatetime(new Date());
wxBillRent.setUpdateBy(user.getId());
wxBillRent.setUpdateByName(user.getName());
String latePayPrice = StringUtils.isBlank(wxBillRent.getLatePayPrice()) ? "0" : wxBillRent.getLatePayPrice();
String latePayPrice = StringUtils.isBlank(wxBillRent.getBillLatePay()) ? "0" : wxBillRent.getBillLatePay();
//wxBillRent.setOwe(new BigDecimal(newPrice).add(new BigDecimal(wxBillRent.getServiceChargePay())).add(new BigDecimal(latePayPrice)).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString());
//wxBillRent.setOwe(new BigDecimal(newPrice).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString());
wxBillRentMapper.updateById(wxBillRent);
@@ -429,14 +427,14 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe

@Override
public ResultData updateLatePayStatus(WxBillRent record) {
record.setLatePayStatus(EnumBillStatus.PAID.getCode());
record.setUpdatetime(new Date());
try {
wxBillRentMapper.updateById(record);
} catch (Exception e) {
logger.error("修改营业额失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "滞纳金结单失败");
}
// record.setLatePayStatus(EnumBillStatus.PAID.getCode());
// record.setUpdatetime(new Date());
// try {
// wxBillRentMapper.updateById(record);
// } catch (Exception e) {
// logger.error("修改营业额失败,e:" + e.getMessage());
// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "滞纳金结单失败");
// }
return new ResultData(Result.SUCCESS, "滞纳金结单成功", record);
}

@@ -454,9 +452,9 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
for (Map.Entry<Long, List<WxBillRent>> entry : entries) {
List<WxBillRent> list = entry.getValue();
for (WxBillRent rent : list) {
if (rent.getDepositStatus() == null) {
rent.setDepositStatus(0);
}
//if (rent.getDepositStatus() == null) {
// rent.setDepositStatus(0);
//}
String shopNumber = rent.getShopNumber();
if (StringUtils.isEmpty(shopNumber)) {
String shopInfo = rent.getShopInfo();
@@ -478,17 +476,17 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
}
private void updateQueryParam(WxBillRent wxBillRent) {
if(null != wxBillRent.getDepositStatus()) {
WxBillDeposit bdq1 = new WxBillDeposit();
bdq1.updateTenantInfo(wxBillRent);
bdq1.setStatus(wxBillRent.getDepositStatus());
List<Long> rentids = wxBillDepositMapper.findRentContractIds(bdq1);
if (null != rentids && rentids.size() > 0 ) {
wxBillRent.setRentContractIdList(rentids);
}else {
wxBillRent.setId(-1L);
}
}
// if(null != wxBillRent.getDepositStatus()) {
// WxBillDeposit bdq1 = new WxBillDeposit();
// bdq1.updateTenantInfo(wxBillRent);
// bdq1.setStatus(wxBillRent.getDepositStatus());
// List<Long> rentids = wxBillDepositMapper.findRentContractIds(bdq1);
// if (null != rentids && rentids.size() > 0 ) {
// wxBillRent.setRentContractIdList(rentids);
// }else {
// wxBillRent.setId(-1L);
// }
// }
if (null != wxBillRent.getFloorForRule() || null != wxBillRent.getFloor() || null != wxBillRent.getBuilding()) {
List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRent, wxBillRent.getFloorForRule(), wxBillRent.getBuilding(), wxBillRent.getFloor(), 0, 0);
if (null != merchantIds) {
@@ -562,16 +560,16 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
if (null != rent) {
decimalSize = rent.getDecimalSize();
e.setMerchantName(rent.getMerchantName());
e.setRentType(rent.getType());
if (StringUtils.isNotBlank(rent.getPayRatio())) {
e.setPayRatio(rent.getPayRatio());
}else {
e.setPayRatio("0");
}
//e.setRentType(rent.getType());
// if (StringUtils.isNotBlank(rent.getPayRatio())) {
// e.setPayRatio(rent.getPayRatio());
// }else {
// e.setPayRatio("0");
// }
// if (StringUtils.isNoneBlank(rent.getLatePayRatio())) {
// e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio()));
// }
e.setLatePayDay(rent.getLatePayDay());
//e.setLatePayDay(rent.getLatePayDay());
e.setShopNumber(rent.getRentInfoShopNumber());
e.setRentShopType(rent.getRentShopType());
}
@@ -595,24 +593,24 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe

@Override
public ResultData updateLatePayMoney(WxBillRent record, MallUserInfo user) {
WxBillRent rent = wxBillRentMapper.selectById(record.getId(),user.getTenantId());
if(record.getLatePayMoneyUpdate() != null) {
rent.setLatePayPrice(record.getLatePayMoneyUpdate());
//rent.setOwe(new BigDecimal(rent.getReceivePay()).add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getServiceChargePay())).subtract(new BigDecimal(rent.getPay())).toPlainString());
//rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString());
final IdWorker idWorker = IdWorker.get();
WxBillAction billAction = new WxBillAction();
billAction.updateTenantInfo(user);
billAction.setId(idWorker.nextId());
billAction.setCreatetime(new Date());
billAction.setUserName("系统端");
billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode());
billAction.setBillId(record.getId());
billAction.setDetails(record.getLatePayMoneyBefore()+"元变更为" +record.getLatePayMoneyUpdate()+"元");
billAction.setUpdatetime(new Date());
wxBillActionMapper.insert(billAction);
}
wxBillRentMapper.updateById(rent);
// WxBillRent rent = wxBillRentMapper.selectById(record.getId(),user.getTenantId());
// if(record.getLatePayMoneyUpdate() != null) {
// rent.setBillLatePay(record.getLatePayMoneyUpdate());
// //rent.setOwe(new BigDecimal(rent.getReceivePay()).add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getServiceChargePay())).subtract(new BigDecimal(rent.getPay())).toPlainString());
// //rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString());
// final IdWorker idWorker = IdWorker.get();
// WxBillAction billAction = new WxBillAction();
// billAction.updateTenantInfo(user);
// billAction.setId(idWorker.nextId());
// billAction.setCreatetime(new Date());
// billAction.setUserName("系统端");
// billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode());
// billAction.setBillId(record.getId());
// billAction.setDetails(record.getLatePayMoneyBefore()+"元变更为" +record.getLatePayMoneyUpdate()+"元");
// billAction.setUpdatetime(new Date());
// wxBillActionMapper.insert(billAction);
// }
// wxBillRentMapper.updateById(rent);
return new ResultData();
}

@@ -651,7 +649,7 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), dbBill.getPay(), dbBill.getPay(),null,null,null,remark,null,null, user);
}else {
if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) {
wxBillRent.setLatePayPrice(dto.getNewLatePrice());
wxBillRent.setBillLatePay(dto.getNewLatePrice());
wxBillRentMapper.updateById(wxBillRent);
this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(),
dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,null,dto.getRemark(),null,null, user);
@@ -760,18 +758,18 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe
BigDecimal latePayLastMoney = new BigDecimal(0);
if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) {
String latePay = dbBill.getLatePayPrice();
String latePay = dbBill.getBillLatePay();
if (StringUtils.isBlank(latePay)) {
latePay = "0";
}
latePayLastMoney = serviceLastMoney.subtract(new BigDecimal(latePay));
if (new BigDecimal(latePay).compareTo(new BigDecimal(0)) > 0 ) {
if (latePayLastMoney.compareTo(new BigDecimal(0)) >= 0 ) {
wxBillRent.setLatePayPrice("0");
wxBillRent.setBillLatePay("0");
sb.append(";滞纳金").append(latePay).append("已结清");
}else {
String lp = new BigDecimal(latePay).subtract(serviceLastMoney).toPlainString();
wxBillRent.setLatePayPrice(lp);
wxBillRent.setBillLatePay(lp);
sb.append(";滞纳金").append(latePay).append("已支付").append(lp);
}
}


+ 20
- 20
mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java Прегледај датотеку

@@ -14,6 +14,7 @@ import com.iformall.domain.dto.FinanceSetOffDTO;
import com.iformall.domain.dto.WxBillPayDTO;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxBillAdvance;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxEnergyFees;
import com.iformall.domain.po.WxEnergyFeesSetoff;
@@ -25,7 +26,6 @@ import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxShop;
import com.iformall.domain.po.base.BaseEntity.SortField;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.domain.vo.FinanceBillSetoffSum;
import com.iformall.domain.vo.FinanceSetOffDetailVo;
import com.iformall.domain.vo.WxFinanceReceiveVo;
@@ -221,7 +221,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
}
Long billFeesId = null;
for (int i = 0 ; i < dto.getBills().size(); i++) {
WxBillBaseEntity b = dto.getBills().get(i);
WxAllBill b = dto.getBills().get(i);
if (null == billFeesId) {
billFeesId = b.getEnergyFeesId();
}else if (billFeesId.equals(b.getEnergyFeesId())) {
@@ -255,7 +255,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
}
//根据预充值收款单来冲抵账单
private void setSetOff(WxBillBaseEntity bill,FinanceSetOffCalcuteDTO calcuteDto) {
private void setSetOff(WxAllBill bill,FinanceSetOffCalcuteDTO calcuteDto) {
BigDecimal owe = new BigDecimal(bill.getOwe());
BigDecimal b0 = new BigDecimal(0);
if (owe.compareTo(b0) <= 0) {
@@ -309,7 +309,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
}
@Override
public List<WxBillBaseEntity> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user) {
public List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user) {
//多个账单类型和科目必须一致
//优先冲抵时间早的账单,优先用时间早的预充费用来冲抵
if (null == dto.getBills() || dto.getBills().size() <= 0 || null == dto.getFeesIdList() || dto.getFeesIdList().size() <= 0 ) {
@@ -321,7 +321,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
return null;
}
//账单排序
List<WxBillBaseEntity> bills = dto.getBills();
List<WxAllBill> bills = dto.getBills();
sortBills(bills);
//每个账单去计算抵扣
WxMerchant merchant = new WxMerchant();
@@ -329,15 +329,15 @@ public class WxFinanceServiceImpl implements WxFinanceService {
FinanceSetOffCalcuteDTO calcuteDto = new FinanceSetOffCalcuteDTO();
calcuteDto.setCurrentIndex(0);
calcuteDto.setAdvanceList(advanceList);
List<WxBillBaseEntity> retList = new ArrayList<WxBillBaseEntity>();
List<WxAllBill> retList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < bills.size() ; i ++) {
WxBillBaseEntity be = bills.get(i);
WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId());
WxAllBill be = bills.get(i);
WxAllBill bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId());
be.setReceivePay(bill.getReceivePay());
be.setPay(bill.getPay());
be.setSetOff(bill.getSetOff());
setSetOff(be, calcuteDto);
WxBillBaseEntity retb = new WxBillBaseEntity();
WxAllBill retb = new WxAllBill();
retb.setId(be.getId());
retb.setSetOffDetailList(be.getSetOffDetailList());
retb.setCurrentSetOff(be.getCurrentSetOff());
@@ -481,10 +481,10 @@ public class WxFinanceServiceImpl implements WxFinanceService {
return pageVo;
}
private void sortBills(List<WxBillBaseEntity> billList) {
Collections.sort(billList, new Comparator<WxBillBaseEntity>() {
private void sortBills(List<WxAllBill> billList) {
Collections.sort(billList, new Comparator<WxAllBill>() {
@Override
public int compare(WxBillBaseEntity o1, WxBillBaseEntity o2) {
public int compare(WxAllBill o1, WxAllBill o2) {
if (o1.getStarttime().before(o2.getStarttime())) {
return -1;
}else if (o1.getStarttime().equals(o2.getStarttime())) {
@@ -504,7 +504,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
@Override
public List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user) {
public List<WxAllBill> createReceive(WxFinanceReceive record,MallUserInfo user) {
//冲抵信息根据页面返回的账单抵扣信息直接保存入库
//费用计算自动优先匹配时间最早的那个
@@ -539,7 +539,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
}
//冲抵总金额
BigDecimal setOffTotal = new BigDecimal(0);
List<WxBillBaseEntity> bills = record.getBills();
List<WxAllBill> bills = record.getBills();
sortBills(bills);
//创建主收款单
@@ -557,7 +557,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
calcuteDto.setTotalSetoff(setOffTotal);
//建立子账单关联单
for (int i = 0 ; i < record.getBills().size(); i++) {
WxBillBaseEntity be = record.getBills().get(i);
WxAllBill be = record.getBills().get(i);
//每个账单要创建一个收款关联单,如果有冲抵,要额外创建
boolean noNeedCreate = createBillReceive(calcuteDto,user,addreceive,be,merchant,payWay0);
if (!noNeedCreate) {
@@ -577,12 +577,12 @@ public class WxFinanceServiceImpl implements WxFinanceService {
return bills;
}
public boolean createBillReceive(FinanceReceiveCalcuteDTO calcuteDto,MallUserInfo user,WxFinanceReceive addreceive,WxBillBaseEntity be,WxMerchant merchant,WxBillPayWay payWay0) {
public boolean createBillReceive(FinanceReceiveCalcuteDTO calcuteDto,MallUserInfo user,WxFinanceReceive addreceive,WxAllBill be,WxMerchant merchant,WxBillPayWay payWay0) {
//如果既没有收款,也没有冲抵,则不更新
boolean noNeedCreate = true;
//计算账单收款费用,更新账单收款
BigDecimal b0 = new BigDecimal(0);
WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId());
WxAllBill bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId());
if (calcuteDto.getTotalRemainReceive().compareTo(b0) > 0) {
noNeedCreate = false;
//有收款,就要更新账单的收款
@@ -659,7 +659,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
return addreceive;
}
public void createFinanceReceiveBill(WxFinanceReceive addreceive,WxBillBaseEntity bill,String billMoney,Long payway) {
public void createFinanceReceiveBill(WxFinanceReceive addreceive,WxAllBill bill,String billMoney,Long payway) {
WxFinanceReceiveBill frbs = new WxFinanceReceiveBill();
frbs.updateTenantInfo(addreceive);
final IdWorker idWorker = IdWorker.get();
@@ -678,7 +678,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
wxFinanceReceiveBillMapper.insert(frbs);
}
public void createFinanceReceiveSetoff(WxFinanceReceive addreceive,WxBillBaseEntity be,WxBillBaseEntity bill) {
public void createFinanceReceiveSetoff(WxFinanceReceive addreceive,WxAllBill be,WxAllBill bill) {
for (int j = 0 ; j < be.getSetOffDetailList().size(); j ++ ) {
FinanceSetOffDetailVo setoffdetail = be.getSetOffDetailList().get(j);
WxFinanceReceive advance = this.getReceiveById(addreceive, setoffdetail.getAdvanceId());
@@ -767,7 +767,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
merchant.updateTenantInfo(record);
for (int i = 0 ; i < receiveBills.size() ; i ++) {
WxFinanceReceiveBill rb = receiveBills.get(i);
WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(rb.getBillType()), merchant, rb.getId());
WxAllBill bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(rb.getBillType()), merchant, rb.getId());
if (rb.getPayWay().equals(Constant.bill_pay_way_setoff)) {
//账单回退
WxBillPayDTO payDto = new WxBillPayDTO();


+ 7
- 7
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Прегледај датотеку

@@ -267,15 +267,15 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxBillRent.setHasFeesStardarsId(EnumYesOrNo.YES.getCode());
wxBillRent.setHasParentBillId(EnumYesOrNo.YES.getCode());
List<WxBillProperty> unFixedList = wxBillPropertyMapper.findList(wxBillRent);
Map<Long,List<WxBillProperty>> childMap = null;
Map<Long,List<WxAllBill>> childMap = null;
if (null != unFixedList && unFixedList.size() > 0 ) {
childMap = new HashMap<Long,List<WxBillProperty>>();
childMap = new HashMap<Long,List<WxAllBill>>();
for (int i = 0 ; i < unFixedList.size(); i++) {
WxBillProperty ub = unFixedList.get(i);
if (null != ub) {
List<WxBillProperty> childList = childMap.get(ub.getParentBillId());
List<WxAllBill> childList = childMap.get(ub.getParentBillId());
if (null == childList) {
childList = new ArrayList<WxBillProperty>();
childList = new ArrayList<WxAllBill>();
childMap.put(ub.getParentBillId(), childList);
}
childList.add(ub);
@@ -285,7 +285,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
if (null != childMap ) {
for (int i = 0 ; i < retList.size(); i ++) {
WxBillProperty ub = retList.get(i);
List<WxBillProperty> childList = childMap.get(ub.getId());
List<WxAllBill> childList = childMap.get(ub.getId());
ub.setChildList(childList);
}
}
@@ -789,10 +789,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxBillProperty.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId());
//非一次性账单
wxBillProperty.setUnFixedbillFeesStandardsList(unFixedList);
List<WxBillProperty> childList = null;
List<WxAllBill> childList = null;
//每个非从一次性都要创建账单
if (null != unFixedList && unFixedList.size() > 0 ) {
childList = new ArrayList<WxBillProperty>();
childList = new ArrayList<WxAllBill>();
for (int j = 0 ; j < unFixedList.size(); j ++ ) {
WxBillFeesStandardsListVo svo = unFixedList.get(j);
svo.setParentBillId(wxBillProperty.getId());


+ 203
- 203
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Прегледај датотеку

@@ -686,18 +686,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bill.updateTenantInfo(record);
bill.setNeedPay(bill.getNeedPay());
bill.setReceivePay(bill.getNeedPay());
bill.setBussinessManageFeeNeedPay(bill.getBussinessManageFeeNeedPay());
bill.setOperatingManageFeeNeedPay(bill.getOperatingManageFeeNeedPay());
// bill.setBussinessManageFeeNeedPay(bill.getBussinessManageFeeNeedPay());
// bill.setOperatingManageFeeNeedPay(bill.getOperatingManageFeeNeedPay());
bill.setUpdatetime(date); bill.setUpdateBy(user.getId());
bill.setUpdateByName(user.getName());
bill.setRentShopType(record.getRentShopType());
bill.setPeriod(count);
//bill.setPeriod(count);
bill.setIsPreview(EnumIsPreview.YES.getCode());
bill.setShopInfo(getShopInfoStr(record));
bill.setRevenue("0");
bill.setLatePayRatio(0);
//bill.setRevenue("0");
//bill.setLatePayRatio(0);
bill.setPay("0");
bill.setIsDel(EnumDelStatus.NOT_DEL.getCode());
//bill.setIsDel(EnumDelStatus.NOT_DEL.getCode());
bill.setStatus(EnumBillStatus.WAIT_PAY.getCode());
bill.setMerchantId(record.getMerchantId());
if (null != shopIds && shopIds.size() == 1) {
@@ -731,7 +731,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
WxBillRentManage wxBillRentManage = new WxBillRentManage();
wxBillRentManage.setRentContractId(record.getId());
wxBillRentManage.setManageFeeType(feeType.getCode());
//wxBillRentManage.setManageFeeType(feeType.getCode());
wxBillRentManage.updateTenantInfo(record);
wxBillRentManageMapper.deletePreviewBill(wxBillRentManage);
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record);
@@ -754,7 +754,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
continue;
}
WxBillRentManage bill = new WxBillRentManage();
bill.initByBillRent(_bi);
//bill.initByBillRent(_bi);
bill.setId(idWorker.nextId());
Date date = new Date();
bill.setRentContractId(record.getId());
@@ -762,18 +762,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bill.setCreateBy(user.getId());
bill.setCreateByName(user.getName());;
bill.updateTenantInfo(record);
bill.setManageFeeType(feeType.getCode());
//bill.setManageFeeType(feeType.getCode());
bill.setNeedPay(needPay.toPlainString());
bill.setReceivePay(needPay.toPlainString());
bill.setUpdatetime(date);
bill.setUpdateBy(user.getId());
bill.setUpdateByName(user.getName());
bill.setRentShopType(record.getRentShopType());
bill.setPeriod(count);
//bill.setPeriod(count);
bill.setShopInfo(getShopInfoStr(record));
bill.setLatePayRatio(0);
//bill.setLatePayRatio(0);
bill.setPay("0");
bill.setIsDel(EnumDelStatus.NOT_DEL.getCode());
//bill.setIsDel(EnumDelStatus.NOT_DEL.getCode());
bill.setStatus(EnumBillStatus.WAIT_PAY.getCode());
bill.setMerchantId(record.getMerchantId());
if (null != shopIds && shopIds.size() == 1) {
@@ -966,7 +966,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillDeposit.setId(idWorker.nextId());
wxBillDeposit.setRentContractId(wxRentContract.getId());
if (null != fees) {
wxBillDeposit.setContractDepoistDetail("合同押金项["+fees.getName()+"]"+depositFee.getPrice()+"元"+"/"+fees.getCalcuteUnitName());
//wxBillDeposit.setContractDepoistDetail("合同押金项["+fees.getName()+"]"+depositFee.getPrice()+"元"+"/"+fees.getCalcuteUnitName());
}
wxBillDeposit.setPay("0");
//String needpay = wxRentContract.getDeposit();
@@ -1211,9 +1211,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
rentList = buildRentMonth(user, wxRentContract, receivePeriod, lease, rentalStartDate, isPreview,saveDb);
}
}
for (int i = 0; i < rentList.size(); i++) {
rentList.get(i).setPeriod(i+1);
}
// for (int i = 0; i < rentList.size(); i++) {
// rentList.get(i).setPeriod(i+1);
// }
return rentList;
}
@@ -1375,118 +1375,118 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return shopInfoStr;
}
private String getRentPriceInfo(WxRentContract wxRentContract, BigDecimal contractNeedPay){
if(contractNeedPay.compareTo(new BigDecimal(0)) == 0){
return null;
}
BigDecimal rentPrice = new BigDecimal(0), siteMoney = new BigDecimal(0), facilityMoney = new BigDecimal(0), administratorMoney = new BigDecimal(0),managementMoney = new BigDecimal(0);
if(!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode())
&& !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_CUSTOMIZE.getCode())){
if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
String[] priceList = WxRentContractHelper.computeRentPriceByShop(wxRentContract).get(0);
BigDecimal sum = new BigDecimal(0);
for (int i = 0 ; i < priceList.length ; i++) {
sum = sum.add(new BigDecimal(priceList[i]));
}
int size = rentInfoArray.size();
for (int i = 0;i < size;i++) {
BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0),e=new BigDecimal(0);
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
String rentPrice1 = rentInfoObject.getString("rentPrice");
if(StringUtils.isNotBlank(rentPrice1)){
a = new BigDecimal(rentPrice1);
}
JSONObject otherRentPriceInfo = rentInfoObject.getJSONObject("otherRentPriceInfo");
if(otherRentPriceInfo != null ){
//场地费
String siteMoney1 = otherRentPriceInfo.getString("siteMoney");
if(StringUtils.isNotBlank(siteMoney1)){
b = new BigDecimal(siteMoney1);
}
//设备费
String facilityMoney1 = otherRentPriceInfo.getString("facilityMoney");
if(StringUtils.isNotBlank(facilityMoney1)){
c = new BigDecimal(facilityMoney1);
}
//商业管理费
String administratorMoney1 = otherRentPriceInfo.getString("administratorMoney");
if(StringUtils.isNotBlank(administratorMoney1)){
d = new BigDecimal(administratorMoney1);
}
//营业管理费
String managementMoney1 = otherRentPriceInfo.getString("managementMoney");
if(StringUtils.isNotBlank(managementMoney1)){
e = new BigDecimal(managementMoney1);
}
}
rentPrice =rentPrice.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
.multiply(a).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
siteMoney =siteMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
.multiply(b).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
facilityMoney =facilityMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
.multiply(c).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
administratorMoney =administratorMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
.multiply(d).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
managementMoney =managementMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
.multiply(e).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
}
}else{
BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0),e=new BigDecimal(0);
String rentPrice1 = wxRentContract.getRentPrice();
if(StringUtils.isNotBlank(rentPrice1)){
//a = new BigDecimal(rentPrice1).divide(new BigDecimal(100));
a = new BigDecimal(rentPrice1);
}
String otherRentPriceInfo1 = wxRentContract.getOtherRentPriceInfo();
if(StringUtils.isNotBlank(otherRentPriceInfo1)){
JSONObject jsonObject = JSONObject.parseObject(otherRentPriceInfo1);
String siteMoney1 = jsonObject.getString("siteMoney");
if(StringUtils.isNotBlank(siteMoney1)){
b = new BigDecimal(siteMoney1);
}
String facilityMoney1 = jsonObject.getString("facilityMoney");
if(StringUtils.isNotBlank(facilityMoney1)){
c = new BigDecimal(facilityMoney1);
}
String administratorMoney1 = jsonObject.getString("administratorMoney");
if(StringUtils.isNotBlank(administratorMoney1)){
d = new BigDecimal(administratorMoney1);
}
String managementMoney1 = jsonObject.getString("managementMoney");
if(StringUtils.isNotBlank(managementMoney1)){
e = new BigDecimal(managementMoney1);
}
}
rentPrice = contractNeedPay.multiply(a).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
siteMoney = contractNeedPay.multiply(b).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
facilityMoney = contractNeedPay.multiply(c).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
administratorMoney = contractNeedPay.multiply(d).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
managementMoney = contractNeedPay.multiply(e).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
}
}else{
rentPrice = contractNeedPay;
}
Map<String,String> resultMap = new HashedMap();
resultMap.put("rentPrice",rentPrice.toString());
resultMap.put("siteMoney",siteMoney.toString());
resultMap.put("facilityMoney",facilityMoney.toString());
resultMap.put("administratorMoney",administratorMoney.toString());
resultMap.put("managementMoney",managementMoney.toString());
return JSON.toJSONString(resultMap);
}
// private String getRentPriceInfo(WxRentContract wxRentContract, BigDecimal contractNeedPay){
// if(contractNeedPay.compareTo(new BigDecimal(0)) == 0){
// return null;
// }
// BigDecimal rentPrice = new BigDecimal(0), siteMoney = new BigDecimal(0), facilityMoney = new BigDecimal(0), administratorMoney = new BigDecimal(0),managementMoney = new BigDecimal(0);
// if(!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) &&
// !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode())
// && !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_CUSTOMIZE.getCode())){
// if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){
// String rentInfo = wxRentContract.getRentInfo();
// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
// String[] priceList = WxRentContractHelper.computeRentPriceByShop(wxRentContract).get(0);
// BigDecimal sum = new BigDecimal(0);
// for (int i = 0 ; i < priceList.length ; i++) {
// sum = sum.add(new BigDecimal(priceList[i]));
// }
// int size = rentInfoArray.size();
// for (int i = 0;i < size;i++) {
// BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0),e=new BigDecimal(0);
// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
//
// String rentPrice1 = rentInfoObject.getString("rentPrice");
// if(StringUtils.isNotBlank(rentPrice1)){
// a = new BigDecimal(rentPrice1);
// }
// JSONObject otherRentPriceInfo = rentInfoObject.getJSONObject("otherRentPriceInfo");
// if(otherRentPriceInfo != null ){
//
// //场地费
// String siteMoney1 = otherRentPriceInfo.getString("siteMoney");
// if(StringUtils.isNotBlank(siteMoney1)){
// b = new BigDecimal(siteMoney1);
// }
// //设备费
// String facilityMoney1 = otherRentPriceInfo.getString("facilityMoney");
// if(StringUtils.isNotBlank(facilityMoney1)){
// c = new BigDecimal(facilityMoney1);
// }
// //商业管理费
// String administratorMoney1 = otherRentPriceInfo.getString("administratorMoney");
// if(StringUtils.isNotBlank(administratorMoney1)){
// d = new BigDecimal(administratorMoney1);
// }
//
// //营业管理费
// String managementMoney1 = otherRentPriceInfo.getString("managementMoney");
// if(StringUtils.isNotBlank(managementMoney1)){
// e = new BigDecimal(managementMoney1);
// }
// }
//
// rentPrice =rentPrice.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
// .multiply(a).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
// siteMoney =siteMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
// .multiply(b).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
// facilityMoney =facilityMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
// .multiply(c).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
// administratorMoney =administratorMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
// .multiply(d).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
// managementMoney =managementMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)
// .multiply(e).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP));
// }
//
// }else{
// BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0),e=new BigDecimal(0);
// String rentPrice1 = wxRentContract.getRentPrice();
// if(StringUtils.isNotBlank(rentPrice1)){
// //a = new BigDecimal(rentPrice1).divide(new BigDecimal(100));
// a = new BigDecimal(rentPrice1);
// }
// String otherRentPriceInfo1 = wxRentContract.getOtherRentPriceInfo();
// if(StringUtils.isNotBlank(otherRentPriceInfo1)){
//
// JSONObject jsonObject = JSONObject.parseObject(otherRentPriceInfo1);
//
// String siteMoney1 = jsonObject.getString("siteMoney");
// if(StringUtils.isNotBlank(siteMoney1)){
// b = new BigDecimal(siteMoney1);
// }
// String facilityMoney1 = jsonObject.getString("facilityMoney");
// if(StringUtils.isNotBlank(facilityMoney1)){
// c = new BigDecimal(facilityMoney1);
// }
// String administratorMoney1 = jsonObject.getString("administratorMoney");
// if(StringUtils.isNotBlank(administratorMoney1)){
// d = new BigDecimal(administratorMoney1);
// }
//
// String managementMoney1 = jsonObject.getString("managementMoney");
// if(StringUtils.isNotBlank(managementMoney1)){
// e = new BigDecimal(managementMoney1);
// }
// }
// rentPrice = contractNeedPay.multiply(a).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
// siteMoney = contractNeedPay.multiply(b).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
// facilityMoney = contractNeedPay.multiply(c).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
// administratorMoney = contractNeedPay.multiply(d).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
// managementMoney = contractNeedPay.multiply(e).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
// }
// }else{
// rentPrice = contractNeedPay;
// }
//
//
// Map<String,String> resultMap = new HashedMap();
// resultMap.put("rentPrice",rentPrice.toString());
// resultMap.put("siteMoney",siteMoney.toString());
// resultMap.put("facilityMoney",facilityMoney.toString());
// resultMap.put("administratorMoney",administratorMoney.toString());
// resultMap.put("managementMoney",managementMoney.toString());
// return JSON.toJSONString(resultMap);
// }
private static Date getCurrentYearRentDate(Date yearEndDate,Date rentDate){
@@ -1652,10 +1652,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setPay("0");
wxBillRent.setStarttime(billTimeVo.getStartDate());
wxBillRent.setEndtime(billTimeVo.getEndDate());
wxBillRent.setReceiveDate(billTimeVo.getReceiveDate());
//wxBillRent.setReceiveDate(billTimeVo.getReceiveDate());
wxBillRent.setContractNeedPay(needpay);
wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,new BigDecimal(needpay)));
//wxBillRent.setContractNeedPay(needpay);
//wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,new BigDecimal(needpay)));
wxBillRent.setNeedPay(needpay);
//wxBillRent.setOwe(needpay);
wxBillRent.setReceivePay(needpay);
@@ -1666,10 +1666,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//截止收租日在当前时间之前
Date date = new Date();
//setExpiredDay(wxBillRent,dayType,receivePeriod);
wxBillRent.setRevenue("0");
//wxBillRent.setRevenue("0");
wxBillRent.updateTenantInfo(wxRentContract);
wxBillRent.setMerchantId(wxRentContract.getMerchantId());
wxBillRent.setUserId(user.getId());
//wxBillRent.setUserId(user.getId());
if (null != wxRentContract.shopIdsByRentInfo() && wxRentContract.shopIdsByRentInfo().size() == 1) {
wxBillRent.setShopId(wxRentContract.shopIdsByRentInfo().get(0));
}
@@ -1679,11 +1679,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setUpdatetime(date);
wxBillRent.setUpdateBy(user.getId());
wxBillRent.setUpdateByName(user.getName());;
wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode());
//wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode());
wxBillRent.setRentShopType(wxRentContract.getRentShopType());
wxBillRent.setPeriod(++billcount);
//wxBillRent.setPeriod(++billcount);
wxBillRent.setShopInfo(shopInfoStr);
wxBillRent.setLatePayRatio(0);
//wxBillRent.setLatePayRatio(0);
wxBillRent.calcuteTotalFee(wxRentContract.getDecimalSize());
wxBillRent.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId());
@@ -1721,7 +1721,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
private WxBillRentManage setManageRent(Integer decimalSize,WxBillRent wxBillRent,EnumRentContractManageFeeType feeType,String needPay,Integer serviceChargeRate,int dayType,int receivePeriod) {
WxBillRentManage manage = new WxBillRentManage();
manage.initByBillRent(wxBillRent);
//manage.initByBillRent(wxBillRent);
if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode().intValue()){
manage.setEnergyFeesId(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId());
}else if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode().intValue()) {
@@ -1729,7 +1729,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
final IdWorker idWorker = IdWorker.get();
wxBillRent.setId(idWorker.nextId());
manage.setManageFeeType(feeType.getCode());
//manage.setManageFeeType(feeType.getCode());
manage.setNeedPay(needPay);
manage.setReceivePay(needPay);
//manage.setOwe(needPay);
@@ -3384,69 +3384,69 @@ public class WxRentContractServiceImpl implements WxRentContractService {
@Override
public void calcuteByTradeDaily(WxRentContract wxRentContract) {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
//查询合同下截止时间为昨天的账单
WxBillRent bq = new WxBillRent();
bq.updateTenantInfo(wxRentContract);
bq.setRentContractId(wxRentContract.getId());
bq.setIsPreview(EnumIsPreview.NO.getCode());
Date current = new Date();
//从上个月1号开始的都更新
bq.setEndtimeBegin(DateUtils.getDayBegin(DateUtils.getFirstDayOfNextMonth(current,-1)));
bq.setEndtimeEnd(current);
bq.setIsDel(EnumDelStatus.NOT_DEL.getCode());
List<WxBillRent> billList = wxBillRentMapper.findList(bq);
if (null != billList && billList.size() > 0 ) {
for (int j = 0 ; j < billList.size(); j++) {
WxBillRent br = billList.get(j);
try {
//判断账单是否跨月,如果跨月,需要按照每月来查询解单金额
BigDecimal needPay = new BigDecimal(0) ;
int months = DateUtils.monthsBetween(br.getStarttime(), br.getEndtime());
if ( months > 0 ) {
for (int i = 0 ; i <= months ; i++ ) {
BigDecimal _money = new BigDecimal(0);
if (i == 0 ) {
_money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(), br.getStarttime(),
DateUtils.getLastDayForMonth(br.getStarttime()));
}else if (i == months){
_money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(),
DateUtils.getFirstDayForCurrMonth(DateUtils.getTimeAfterMonths(i,br.getStarttime())),
DateUtils.getDayEnd(DateUtils.getTimeAfterDays(-1, br.getEndtime())));
}else {
Date _date = DateUtils.getTimeAfterMonths(i,br.getStarttime());
_money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(),
DateUtils.getFirstDayForCurrMonth(_date),
DateUtils.getLastDayForMonth(_date));
}
needPay = needPay.add(_money);
}
}else {
//同一个月
//合同账单结束的时间是00:00:00,取日期要取前一天
needPay = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(),
br.getStarttime(), DateUtils.getDayEnd(br.getEndtime()));
}
needPay = needPay.multiply(new BigDecimal(wxRentContract.getPayRatio()))
.divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP);
String oldNeedPay = br.getNeedPay();
if (needPay.compareTo(new BigDecimal(br.getNeedPay())) > 0) {
br.setNeedPay(needPay.toPlainString());
//br.setOwe(needPay.toPlainString());
br.setReceivePay(needPay.toPlainString());
br.setUpdatetime(new Date());
BigDecimal servicePay = new BigDecimal(br.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP);
br.setServiceChargePay(servicePay.toPlainString());
//br.setOwe(new BigDecimal(br.getReceivePay()).add(new BigDecimal(br.getServiceChargePay())).toPlainString());
//br.setOwe(new BigDecimal(br.getReceivePay()).toPlainString());
br.setComments("原金额["+oldNeedPay+"(分)]小于解单金额["+needPay+"(分)],系统自动更新");
wxBillRentMapper.updateById(br);
}
}catch(Exception e) {
logger.error("calcuteByTradeDaily error:"+br.getId(),e);
}
}
}
// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
// //查询合同下截止时间为昨天的账单
// WxBillRent bq = new WxBillRent();
// bq.updateTenantInfo(wxRentContract);
// bq.setRentContractId(wxRentContract.getId());
// bq.setIsPreview(EnumIsPreview.NO.getCode());
// Date current = new Date();
// //从上个月1号开始的都更新
// bq.setEndtimeBegin(DateUtils.getDayBegin(DateUtils.getFirstDayOfNextMonth(current,-1)));
// bq.setEndtimeEnd(current);
// bq.setIsDel(EnumDelStatus.NOT_DEL.getCode());
// List<WxBillRent> billList = wxBillRentMapper.findList(bq);
// if (null != billList && billList.size() > 0 ) {
// for (int j = 0 ; j < billList.size(); j++) {
// WxBillRent br = billList.get(j);
// try {
// //判断账单是否跨月,如果跨月,需要按照每月来查询解单金额
// BigDecimal needPay = new BigDecimal(0) ;
// int months = DateUtils.monthsBetween(br.getStarttime(), br.getEndtime());
// if ( months > 0 ) {
// for (int i = 0 ; i <= months ; i++ ) {
// BigDecimal _money = new BigDecimal(0);
// if (i == 0 ) {
// _money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(), br.getStarttime(),
// DateUtils.getLastDayForMonth(br.getStarttime()));
// }else if (i == months){
// _money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(),
// DateUtils.getFirstDayForCurrMonth(DateUtils.getTimeAfterMonths(i,br.getStarttime())),
// DateUtils.getDayEnd(DateUtils.getTimeAfterDays(-1, br.getEndtime())));
// }else {
// Date _date = DateUtils.getTimeAfterMonths(i,br.getStarttime());
// _money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(),
// DateUtils.getFirstDayForCurrMonth(_date),
// DateUtils.getLastDayForMonth(_date));
// }
// needPay = needPay.add(_money);
// }
// }else {
// //同一个月
// //合同账单结束的时间是00:00:00,取日期要取前一天
// needPay = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(),
// br.getStarttime(), DateUtils.getDayEnd(br.getEndtime()));
// }
// needPay = needPay.multiply(new BigDecimal(wxRentContract.getPayRatio()))
// .divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP);
// String oldNeedPay = br.getNeedPay();
// if (needPay.compareTo(new BigDecimal(br.getNeedPay())) > 0) {
// br.setNeedPay(needPay.toPlainString());
// //br.setOwe(needPay.toPlainString());
// br.setReceivePay(needPay.toPlainString());
// br.setUpdatetime(new Date());
// BigDecimal servicePay = new BigDecimal(br.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP);
// br.setServiceChargePay(servicePay.toPlainString());
// //br.setOwe(new BigDecimal(br.getReceivePay()).add(new BigDecimal(br.getServiceChargePay())).toPlainString());
// //br.setOwe(new BigDecimal(br.getReceivePay()).toPlainString());
// br.setComments("原金额["+oldNeedPay+"(分)]小于解单金额["+needPay+"(分)],系统自动更新");
// wxBillRentMapper.updateById(br);
// }
// }catch(Exception e) {
// logger.error("calcuteByTradeDaily error:"+br.getId(),e);
// }
// }
// }
}
private BigDecimal sumTradeDailyBySameMonthDay(Integer decimalSize,TenantEntity tenantEntity,Long merchantId,Date begin ,Date end) {
@@ -3493,11 +3493,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//删除商业管理费账单
WxBillRentManage wxBillRentManage = new WxBillRentManage();
wxBillRentManage.setRentContractId(record.getId());
wxBillRentManage.setManageFeeType(EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode());
//wxBillRentManage.setManageFeeType(EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode());
wxBillRentManage.updateTenantInfo(record);
wxBillRentManageMapper.deletePreviewBill(wxBillRentManage);
//删除营业管理费账单
wxBillRentManage.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode());
//wxBillRentManage.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode());
wxBillRentManageMapper.deletePreviewBill(wxBillRentManage);
}
}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/payBill/PayBillAdapterService.java Прегледај датотеку

@@ -2,15 +2,15 @@ package com.iformall.service.payBill;

import java.util.Map;

import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.base.WxBillBaseEntity;

public interface PayBillAdapterService {

//发起支付,有可能是码,小程序支付,或者其他支付
public Object createPay(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxBillBaseEntity billdetail,Double money,Map<String,String> params) throws Exception;
public Object createPay(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxAllBill billdetail,Double money,Map<String,String> params) throws Exception;
//支付通知处理
public void paidCallBack(String tenantId,WxBillPayWay payWay,Map paramMap);


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangMaServiceImpl.java Прегледај датотеку

@@ -13,10 +13,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumBillAllType;
import com.iformall.service.payBill.PayBillAdapterService;
import com.iformall.service.payBill.impl.PayBillBaseService;
@@ -40,7 +40,7 @@ public class JianHangMaServiceImpl extends PayBillBaseService implements PayBill
//建行动态二维码接口
@Override
public Object createPay(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxBillBaseEntity billdetail,Double money,Map<String, String> params) throws Exception {
public Object createPay(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxAllBill billdetail,Double money,Map<String, String> params) throws Exception {
return QrDemo.getMa(wxPayAccountBill, buser, billdetail, money);
}



+ 2
- 2
mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/QrDemo.java Прегледај датотеку

@@ -7,9 +7,9 @@ import java.util.Map;

import com.google.gson.Gson;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.utils.DateUtils;
import com.iformall.utils.HttpUtil;

@@ -20,7 +20,7 @@ public class QrDemo {
private static final String bankURL="https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain";
public static String getMa(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxBillBaseEntity billdetail,Double money) throws Exception {
public static String getMa(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxAllBill billdetail,Double money) throws Exception {
String MERCHANTID = wxPayAccountBill.getPayConfigString("MERCHANTID");
String POSID = wxPayAccountBill.getPayConfigString("POSID");
String BRANCHID = wxPayAccountBill.getPayConfigString("BRANCHID");


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/payBill/impl/wx/WxMiniProgramServiceImpl.java Прегледај датотеку

@@ -13,11 +13,11 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPayAccount;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.base.WxBillBaseEntity;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumBillAllType;
import com.iformall.exception.MallinkException;
@@ -42,7 +42,7 @@ public class WxMiniProgramServiceImpl extends PayBillBaseService implements PayB
WxPayAccountService wxPayAccountService;
@Override
public Object createPay(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxBillBaseEntity billdetail,Double money,Map<String, String> params) throws Exception{
public Object createPay(WxPayAccountBill wxPayAccountBill,WxMerchantBUser buser,WxAllBill billdetail,Double money,Map<String, String> params) throws Exception{
String openId = params.get("openId");
if (StringUtils.isBlank(openId)) {
throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND.getCode(),"参数openId为空");


+ 242
- 0
mallinkService/src/main/resources/mapper/WxAllBillMapper.xml Прегледај датотеку

@@ -0,0 +1,242 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxAllBillMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxAllBill">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
<result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="create_by_name" jdbcType="VARCHAR" property="createByName"/>
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
<result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/>
<result column="need_pay" jdbcType="VARCHAR" property="needPay"/>
<result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/>
<result column="pay" jdbcType="VARCHAR" property="pay"/>
<result column="bill_type" jdbcType="INTEGER" property="billType"/>
<result column="pay_way" jdbcType="BIGINT" property="payWay"/>
<result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/>
<result column="set_off" jdbcType="VARCHAR" property="setOff"/>
<result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
<result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/>
<result column="return_pay" jdbcType="VARCHAR" property="returnPay"/>
<result column="bill_remark" jdbcType="VARCHAR" property="billRemark"/>
<result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/>
<result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/>
<result column="bussiness_manage_fee_need_pay" jdbcType="VARCHAR" property="bussinessManageFeeNeedPay"/>
<result column="operating_manage_fee_need_pay" jdbcType="VARCHAR" property="operatingManageFeeNeedPay"/>
<result column="shop_id" jdbcType="BIGINT" property="shopId"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="is_preview" jdbcType="INTEGER" property="isPreview"/>
<result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/>
<result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/>
<result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
<result column="parent_bill_id" jdbcType="BIGINT" property="parentBillId"/>
<result column="energy_reading_calcuteId" jdbcType="BIGINT" property="energyReadingCalcuteId" />
<result column="energy_reading_id" jdbcType="BIGINT" property="energyReadingId" />
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`rent_shop_type`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`,
`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`,`bill_remark`,
`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`,`is_preview`,
`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`
</sql>

<sql id="dynamicWhereConditions">
where `tenant_id` = #{tenantId}
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != parentTenantId and '' != parentTenantId"> and `parent_tenant_id` = #{parentTenantId}</if>
<if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != createBy ">and `create_by` = #{createBy}</if>
<if test=" null != createByName and '' != createByName"> and `create_by_name` like concat('%',#{createByName},'%')</if>
<if test=" null != billType ">and `bill_type` = #{billType}</if>
<if test=" null != payWay ">and `pay_way` = #{payWay}</if>
<if test=" null != status ">and `status` = #{status}</if>
<if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if>
<if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
<if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
<if test=" null != parentBillId ">and `parent_bill_id` = #{parentBillId}</if>
<if test=" null != isPreview ">and `is_preview` = #{isPreview}</if>
<if test=" null != starttime">and `starttime` &lt;= #{starttime}</if>
<if test=" null != endtime">and `endtime` &gt;= #{endtime}</if>
<if test=" null != month and '' != month">
and date_format(starttime,'%Y-%m') &lt;= #{month} and date_format(endtime,'%Y-%m') &gt;= #{month}
</if>
<if test=" null == nearBillLastTime and null != oweBillLastTime">
and (`starttime` &lt;= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and status not in (3,6,7))
</if>
<if test=" null != nearBillLastTime and null != oweBillLastTime">
and (`starttime` &gt; #{oweBillLastTime} and `starttime` &lt;= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and status not in (3,6,7))
</if>
<if test=" null != needPayStartDay">
and (`starttime` &lt;= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and status not in (3,6,7))
</if>
<if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and status not in (3,6,7) )</if>
<if test=" null != hasMerchant ">and `merchant_id` is not null</if>
<if test=" 1 == hasParentBillId ">and `parent_bill_id` is not null</if>
<if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if>
<if test=" 1 == hasFeesStardarsId ">and `energy_fees_id` is not null</if>
<if test=" 0 == hasFeesStardarsId ">and `energy_fees_id` is null</if>
<if test=" null != energyReadingCalcuteId ">and `energy_reading_calcuteId` = #{energyReadingCalcuteId}</if>
<if test=" null != energyReadingId ">and `energy_reading_id` = #{energyReadingId}</if>
<if test=" null != rentContractIdList ">
and `rent_contract_id` in
<foreach collection="rentContractIdList" index="index" item="ridItem" open="(" separator="," close=")">
#{ridItem}
</foreach>
</if>
<if test=" null != propertyContractIds ">
and property_contract_id in
<foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")">
#{pidItem}
</foreach>
</if>
<if test=" null != merchantIdList ">
and `merchant_id` in
<foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
#{midItem}
</foreach>
</if>
<if test=" null != statusList ">
and `status` in
<foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")">
#{stItem}
</foreach>
</if>
<if test=" null != notInIds ">
and id not in
<foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")">
#{nidItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test="null != limitStart and null != limitEnd">
limit #{limitStart},#{limitEnd}
</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_all_bill
<include refid="dynamicWhereConditions"/>
</select>
<select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_all_bill where id = #{id} and `tenant_id` = #{tenantId}
</select>
<select id="queryBillRentContractIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long">
select distinct rent_contract_id from wx_all_bill
<include refid="dynamicWhereConditions"/>
</select>
<resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum">
<result column="receive_pay" jdbcType="VARCHAR" property="needPay"/>
<result column="paid" jdbcType="VARCHAR" property="paid" />
<result column="min_date" jdbcType="TIMESTAMP" property="minDate" />
<result column="max_date" jdbcType="TIMESTAMP" property="maxDate" />
<result column="return_pay" jdbcType="VARCHAR" property="returnPay"/>
<result column="set_off" jdbcType="VARCHAR" property="setOff"/>
</resultMap>
<select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxAllBill" resultMap="SumBaseResultMap">
select
sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay ,
sum(CAST(pay AS DECIMAL(20,2))) paid,
min(starttime) min_date,
max(endtime) max_date,
sum(CAST(set_off AS DECIMAL(20,2))) set_off ,
sum(CAST(return_pay AS DECIMAL(20,2))) return_pay
from wx_all_bill
<include refid="dynamicWhereConditions"/>
</select>
<select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long">
select distinct merchant_id from wx_all_bill
<include refid="dynamicWhereConditions"/>
</select>
<resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify">
<result column="total_count" jdbcType="INTEGER" property="totalCount"/>
<result column="total_money" jdbcType="VARCHAR" property="totalMoney" />
<result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/>
<result column="bill_type" jdbcType="INTEGER" property="billType"/>
</resultMap>
<select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxAllBill" resultMap="HotNotifyBaseResultMap">
select
bill_type,
count(1) total_count ,
sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) + CAST(IFNULL(`return_pay`,'0') AS DECIMAL(20,2))) total_money,
MIN(br.starttime) min_begin_time from wx_all_bill
<include refid="queryBillRentListCondition"/>
group by bill_type
</select>
<resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify">
<result column="bill_type" jdbcType="INTEGER" property="billType"/>
<result column="bill_id" jdbcType="BIGINT" property="billId" />
<result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
<result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
<result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/>
<result column="pay" jdbcType="VARCHAR" property="pay"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
</resultMap>
<select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxAllBill" resultMap="NotifyResultMap">
select bill_type,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_all_bill br
<include refid="queryBillRentListCondition"/>
</select>
<delete id="deleteBillByContract" parameterType="com.iformall.domain.po.WxRentContract">
delete from wx_all_bill where rent_contract_id = #{id}
</delete>
<delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxAllBill">
delete from wx_all_bill where rent_contract_id = #{rentContractId}
<if test=" null != isPreview "> and is_preview = #{isPreview}</if>
</delete>
<delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxAllBill">
delete from wx_all_bill where rent_contract_id = #{rentContractId} and is_preview = 0 and status = 2
and starttime &gt; #{shopEndtime} and IFNULL(`pay`,'0') &lt;= 0 AND IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0
</delete>

<update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxAllBill">
update wx_all_bill set is_preview = #{isPreview},merchant_id = #{merchantId},need_pay = receive_pay
where rent_contract_id = #{rentContractId}
</update>

<insert id="insertBills" parameterType="HashMap">
INSERT INTO wx_all_bill (
<include refid="allColumns"/>
)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id},#{item.tenantId},#{item.parentTenantId},#{item.merchantId},#{item.rentShopType},#{item.createtime},
#{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.needPay},
#{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff},
#{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark},
#{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay},
#{item.shopId},#{item.shopNumber},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.propertyContractId},
#{item.parentBillId},#{item.energyReadingCalcuteId},#{item.energyReadingId}
)
</foreach>
</insert>
<delete id = "deleteById" parameterType="HashMap">
delete from wx_all_bill where id = #{id} and tenant_id = #{tenantId}
</delete>

</mapper>


Loading…
Откажи
Сачувај