Browse Source

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_legion_activity

release_toaliyun_real
xiaohu 1 year ago
parent
commit
21e6587fe9
18 changed files with 379 additions and 36 deletions
  1. +58
    -13
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  2. +14
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java
  3. +10
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java
  5. +37
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveBill.java
  6. +12
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContractRevenueSales.java
  7. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java
  8. +4
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxRentContractRevenueSalesMapper.java
  9. +1
    -0
      mallinkService/src/main/java/com/iformall/service/WxFinanceService.java
  10. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxRentContractService.java
  11. +2
    -1
      mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java
  12. +15
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java
  13. +111
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java
  14. +55
    -15
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  15. +2
    -0
      mallinkService/src/main/java/com/iformall/utils/DateUtils.java
  16. +6
    -0
      mallinkService/src/main/resources/mapper/WxAllBillMapper.xml
  17. +26
    -1
      mallinkService/src/main/resources/mapper/WxFinanceReceiveBillMapper.xml
  18. +21
    -2
      mallinkService/src/main/resources/mapper/WxRentContractRevenueSalesMapper.xml

+ 58
- 13
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java View File

@@ -837,29 +837,39 @@ public class WxRentContractController extends WxContractBaseController {
bq.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode());
bq.setSortColumn(" starttime asc");
List<WxAllBill> billList = wxAllBillService.list(bq);
if (null == billList || billList.size() <= 0 ) {
return new ResultData();
}
List<WxAllBill> validBillList = new ArrayList<WxAllBill>();
WxRentContract rc = new WxRentContract();
rc.updateTenantInfo(sales);
rc.setId(sales.getRentContractId());
List<WxRentContractRevenueSales> salesList = wxRentContractService.getContractSales(rc);
if (null != salesList && salesList.size() > 0 && null != billList && billList.size() > 0 ) {
Map<Long,WxRentContractRevenueSales> billSalesMap = new HashMap<Long,WxRentContractRevenueSales>();
Map<Long,WxRentContractRevenueSales> billSalesMap = new HashMap<Long,WxRentContractRevenueSales>();
if (null != salesList && salesList.size() > 0) {
for (int i = 0 ; i < salesList.size() ; i ++ ) {
WxRentContractRevenueSales rs = salesList.get(i);
billSalesMap.put(rs.getBillId(), rs);
}
for (int i = 0 ; i < billList.size() ; i ++) {
WxAllBill bill = billList.get(i);
WxRentContractRevenueSales s = billSalesMap.get(bill.getId());
if (null != s) {
bill.setSales(s.getSaleMoney());
bill.setSalesTime(s.getUpdateTime());
}
}
}
return new ResultData(billList);
for (int i = 0 ; i < billList.size() ; i ++) {
WxAllBill bill = billList.get(i);
WxRentContractRevenueSales s = billSalesMap.get(bill.getId());
if (null != s) {
bill.setSales(s.getSaleMoney());
bill.setSalesTime(s.getUpdateTime());
if (s.getIsConfirm() == EnumYesOrNo.YES.getCode()) {
//
}else {
validBillList.add(bill);
}
}else {
validBillList.add(bill);
}
}
return new ResultData(validBillList);
}
//查询商户计租合同列表
@@ -912,6 +922,24 @@ public class WxRentContractController extends WxContractBaseController {
return new ResultData(wxRentContractService.getRentContractYears(rentContract));
}
//查询合同年限已输入销售额情况
@GetMapping("getContractYearsSales")
public ResultData getContractYearsSales(@ModelAttribute WxRentContract wxRentContract) {
if (null == wxRentContract) wxRentContract = new WxRentContract();
WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId());
return new ResultData(wxRentContractService.getContractSales(rentContract));
}
@PostMapping("setContractYearsSalesConfirm")
public ResultData setContractYearsSalesConfirm(@RequestBody WxRentContract wxRentContract) {
WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId());
if (null == rentContract) {
return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同");
}
wxRentContractService.setContractSalesConfirm(rentContract);
return new ResultData();
}
/**
* 取高年度汇算计算
* @param wxRentContract
@@ -934,6 +962,23 @@ public class WxRentContractController extends WxContractBaseController {
}
return new ResultData(wxRentContractService.calcuteYearsRevenueRentUp(rentContract));
}
//查询合同年度汇算账单列表
@GetMapping("getYearsRevenueRentUpBills")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData getYearsRevenueRentUpBills(@ModelAttribute WxRentContract wxRentContract, Integer pageNum, Integer pageSize) {
if (null == wxRentContract) wxRentContract = new WxRentContract();
WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId());
WxAllBill billd = new WxAllBill();
billd.updateTenantInfo(rentContract);
billd.setRentContractId(rentContract.getId());
//删除这个时间的,不设置结束时间,因为可能之前有了账单。,然后撤铺,结束时间虽然不一样,开始时间是一致的。
billd.setStarttimeEqual(rentContract.getYearsBegin());
billd.setExtraCreateFrom(EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN.getCode());
return new ResultData(wxAllBillService.listAsPage(billd,pageNum,pageSize));
}

}


+ 14
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java View File

@@ -14,6 +14,7 @@ import com.iformall.domain.po.WxBillPayWay;
import com.iformall.domain.po.WxEnergyFees;
import com.iformall.domain.po.WxFinanceFinish;
import com.iformall.domain.po.WxFinanceReceive;
import com.iformall.domain.po.WxFinanceReceiveBill;
import com.iformall.domain.po.WxFinanceReceiveSetoff;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.vo.FinanceBillSetoffSum;
@@ -317,6 +318,19 @@ public class WxFinanceController extends BaseController {
return new ResultData(list);
}
@ApiOperation("收款记录子账单列表")
@GetMapping("receiveBillList")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true),
})
public ResultData receiveBillList(@ModelAttribute WxFinanceReceiveBill record, Integer pageNum, Integer pageSize) {
record.updateTenantInfo(getTenantInfo());
record.setSortColumns(BaseEntity.SortField.CreateTime_DESC);
PageInfo<WxFinanceReceiveBill> page = wxFinanceService.receiveBillListAsPage(record, pageNum, pageSize);
return new ResultData(page);
}
@ApiOperation("收款记录列表(收款列表页面,有子账单)")
@GetMapping("receiveList")
@ApiImplicitParams({


+ 10
- 1
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java View File

@@ -751,7 +751,16 @@ public class WxAllBillController extends BillBaseController {
record.setOweBillLastTime(billAllHelper.getDateBefore(getOweBillBeforeDays()));
record.setNearBillLastTime(billAllHelper.getDateBefore(getNearBillBeforeDays()));
}
}
if (StringUtils.isNotBlank(record.getEnergyFeesIdStr())) {
String[] feesIds = record.getEnergyFeesIdStr().split(",");
List<Long> feesIdList = new ArrayList<Long>();
if (null != feesIds && feesIds.length > 0 ) {
for (int i = 0 ; i < feesIds.length ; i ++) {
feesIdList.add(Long.parseLong(feesIds[i]));
}
}
record.setEnergyFeesIds(feesIdList);;
}
record.setIsPreview(EnumYesOrNo.NO.getCode());
record.setSortColumns("status asc, starttime asc , merchant_id desc");


+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java View File

@@ -385,4 +385,6 @@ public class WxAllBill extends TenantEntity {
public List<Long> energyFeesIds;
@TableField(exist = false)
public Integer advanceHasMoney;
@TableField(exist = false)
private String energyFeesIdStr;
}

+ 37
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveBill.java View File

@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumBillAllType;
import com.iformall.enums.EnumFinanceCashierType;
import com.iformall.utils.Constant;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
import java.util.List;
/**
*/
@TableName(value = "wx_finance_receive_bill")
@@ -26,6 +28,10 @@ public class WxFinanceReceiveBill extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime")
private Date createTime;
@TableField(exist = false)
private Date createTimeBegin;
@TableField(exist = false)
private Date createTimeEnd;
@io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime")
private Date updateTime;
@@ -41,7 +47,10 @@ public class WxFinanceReceiveBill extends TenantEntity {
@TableField(exist = false)
private String billTypeName;
public String getBillTypeName() {
return EnumBillAllType.getEnum(billType).getMessage();
if (null != billType) {
return EnumBillAllType.getEnum(billType).getMessage();
}
return null;
}
@io.swagger.annotations.ApiModelProperty(value="科目编号",name="feesId")
@@ -54,6 +63,17 @@ public class WxFinanceReceiveBill extends TenantEntity {
@TableField(exist = false)
private String payWayName;
@io.swagger.annotations.ApiModelProperty(value = "类型EnumFinanceCashierType", name = "type")
private Integer type;
@TableField(exist = false)
private String typeName;
public String getTypeName() {
if (null != type) {
return EnumFinanceCashierType.getEnum(type).getMessage();
}
return null;
}
@io.swagger.annotations.ApiModelProperty(value="实收金额",name="receive")
private String receive;
@@ -89,8 +109,24 @@ public class WxFinanceReceiveBill extends TenantEntity {
return setOff;
}
@TableField(exist = false)
private String payWayStr;
@TableField(exist = false)
private String feesIdStr;
@TableField(exist = false)
private String shopNumber;
@TableField(exist = false)
private Long building;
@TableField(exist = false)
private Long floor;
@TableField(exist = false)
private String merchantName;
@TableField(exist = false)
private List<Long> payWayList;
@TableField(exist = false)
private List<Long> feesIdList;
@TableField(exist = false)
private Integer noReduce;
@TableField(exist = false)
private List<Long> merchantIdList;
}

+ 12
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxRentContractRevenueSales.java View File

@@ -35,6 +35,12 @@ public class WxRentContractRevenueSales extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId")
private Long billId;
@io.swagger.annotations.ApiModelProperty(value = "账单开始日期", name = "starttime")
private Date starttime;
@io.swagger.annotations.ApiModelProperty(value = "账单结束日期", name = "endtime")
private Date endtime;
@io.swagger.annotations.ApiModelProperty(value="账单应付金额",name="minMoney")
private String billMoney;
@@ -50,4 +56,10 @@ public class WxRentContractRevenueSales extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="备注",name="remark")
private String remark;
@io.swagger.annotations.ApiModelProperty(value="是否已确认",name="isConfirm")
private Integer isConfirm;
@io.swagger.annotations.ApiModelProperty(value="是否已计算",name="isCalcute")
private Integer isCalcute;
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java View File

@@ -26,6 +26,7 @@ public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> {
void deletePreviewBill(WxAllBill wxBillRent);
void deleteNoNeedPayBill(WxAllBill wxBillRent);
void deleteByRentHuiSuan(WxAllBill wxBillRent);
Integer countValidBillCountByRentHuiSuan(WxAllBill wxBillRent);
void deleteByRentReveneuSales(WxAllBill wxBillRent);
void updatePreviewStatus(WxAllBill record);


+ 4
- 0
mallinkService/src/main/java/com/iformall/mapper/WxRentContractRevenueSalesMapper.java View File

@@ -19,5 +19,9 @@ public interface WxRentContractRevenueSalesMapper extends CommonMapper<WxRentCon
BigDecimal findSumSalesMoneyValid(WxRentContractRevenueSales wxBillRent);
List<Long> findBillId(WxRentContractRevenueSales wxBillRent);
void updateConfirm(WxRentContractRevenueSales wxBillRent);
void updateCalcute(WxRentContractRevenueSales wxBillRent);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/WxFinanceService.java View File

@@ -33,6 +33,7 @@ public interface WxFinanceService {
//收付款
PageInfo<WxFinanceReceiveVo> receiveVoListWithBillsAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize);
PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize);
PageInfo<WxFinanceReceiveBill> receiveBillListAsPage(WxFinanceReceiveBill record, Integer pageIndex, Integer pageSize);
List<WxFinanceReceive> findReceiveList(WxFinanceReceive record);
Map createReceive(WxFinanceReceive record,MallUserInfo user);
Map createPay(WxFinanceReceive record,MallUserInfo user);


+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxRentContractService.java View File

@@ -164,6 +164,8 @@ public interface WxRentContractService {
WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract,String sales,Long billId,Long propertyContractId);
void setContractSalesConfirm(WxRentContract wxRentContract);
WxRentContractYearsSumVo calcuteYearsRevenueRentUp(WxRentContract rentcontract);
List<WxRentContractRevenueJump> findJumpList(WxRentContractRevenueJump jump);


+ 2
- 1
mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java View File

@@ -140,7 +140,7 @@ public class WxEnergyHelper {
return formula;
}
public void testCalcute(String formula) {
public void testCalcute(String formula,String shopPulicRax) {
if (StringUtils.isBlank(formula)) {
return ;
}
@@ -153,6 +153,7 @@ public class WxEnergyHelper {
formula = formula.replaceAll(relpaceFloorArea, "1");
}
}
formula = formula.replaceAll("#shopPublicRax#", shopPulicRax);
FormulaParser.evaluate(formula);
}


+ 15
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java View File

@@ -551,14 +551,23 @@ public class WxEnergyServiceImpl implements WxEnergyService {
return retList;
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
@Override
public void createFeesShop(WxEnergyFeesShop record) {
//新增关联
final IdWorker idWorker = IdWorker.get();
Date date = new Date();
WxEnergyFees fees = this.getFeesById(record.getFeesId(),record.getTenantId());
WxShop sq = new WxShop();
sq.updateTenantInfo(record);
sq.setIds(record.getShopIds());
Map<Long, WxShop> shopMap = wxShopService.findShopMap(sq);
for (int i = 0 ; i < record.getShopIds().size(); i ++) {
Long shopId = record.getShopIds().get(i);
WxShop shop = shopMap.get(shopId);
if (StringUtils.isBlank(shop.getPulicRate())) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺未设置公摊系数");
}
WxEnergyFeesShop msf = new WxEnergyFeesShop();
msf.updateTenantInfo(record);
msf.setId(idWorker.nextId());
@@ -580,7 +589,7 @@ public class WxEnergyServiceImpl implements WxEnergyService {
msf.setFormulaListStr(JSON.toJSONString(record.getFormulaList()));
}
msf.setFormula(record.getFormula());
wxEnergyHelper.testCalcute(record.getFormula());
wxEnergyHelper.testCalcute(record.getFormula(),shop.getPulicRate());
wxEnergyFeesShopMapper.insert(msf);
}
}
@@ -617,7 +626,11 @@ public class WxEnergyServiceImpl implements WxEnergyService {
if (null != record.getFormulaList() && record.getFormulaList().size() > 0 ) {
record.setFormulaListStr(JSON.toJSONString(record.getFormulaList()));
}
wxEnergyHelper.testCalcute(record.getFormula());
WxShop shop = wxShopService.getById(record.getShopId());
if (StringUtils.isBlank(shop.getPulicRate())) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺未设置公摊系数");
}
wxEnergyHelper.testCalcute(record.getFormula(),shop.getPulicRate());
wxEnergyFeesShopMapper.updateById(record);
}


+ 111
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java View File

@@ -55,6 +55,8 @@ import com.iformall.service.WxShopService;
import com.iformall.service.helper.WxBillAllHelper;
import com.iformall.utils.Constant;
import com.iformall.utils.DateUtils;
import com.iformall.utils.StringContentUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -516,6 +518,114 @@ public class WxFinanceServiceImpl implements WxFinanceService {
return receiveVoListAsPage(record, pageIndex, pageSize, false);
}
@Override
public PageInfo<WxFinanceReceiveBill> receiveBillListAsPage(WxFinanceReceiveBill record, Integer pageIndex, Integer pageSize) {
initReceiveBillQueryParam(record);
PageInfo<WxFinanceReceiveBill> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFinanceReceiveBillMapper.findList(record));
if (null != page && null != page.getList()) {
WxMerchant mq = new WxMerchant();
mq.updateTenantInfo(record);
Map<Long, WxMerchant> merchantMap = wxMerchantService.findMerchantMap(mq);
Map<Long,String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, null, null);
WxBillPayWay pq = new WxBillPayWay();
pq.updateTenantInfo(record);
Map<Long, WxBillPayWay> paywayMap = this.getPayWayMap(pq);
WxEnergyFees fq = new WxEnergyFees();
fq.updateTenantInfo(record);
Map<Long, WxEnergyFees> fmap = wxEnergyService.getFeesMap(fq);
for (int i = 0 ; i < page.getList().size() ; i++) {
WxFinanceReceiveBill fr = page.getList().get(i);
if (null != merchantMap && null != fr.getMerchantId()) {
WxMerchant merchant = merchantMap.get(fr.getMerchantId());
if (null != merchant) {
fr.setMerchantName(merchant.getName());
}
String shopNumber = shopNumberMap.get(fr.getMerchantId());
fr.setShopNumber(shopNumber);
}
if (null != paywayMap && null != fr.getPayWay()) {
WxBillPayWay p = paywayMap.get(fr.getPayWay());
if (null != p) {
fr.setPayWayName(p.getName());
}
}
if (null != fmap && null != fr.getFeesId()) {
WxEnergyFees ef = fmap.get(fr.getFeesId());
if (null != ef) {
fr.setFeesName(ef.getName());
}
}
}
}
return page;
}
private void initReceiveBillQueryParam(WxFinanceReceiveBill record) {
if (StringUtils.isNotBlank(record.getMerchantName()) || StringUtils.isNotBlank(record.getShopNumber())) {
record.setMerchantName(StringContentUtils.unescapeHtml(record.getMerchantName()));
record.setShopNumber(StringContentUtils.unescapeHtml(record.getMerchantName()));
}
if (StringUtils.isNotBlank(record.getPayWayStr())) {
String[] payways = record.getPayWayStr().split(",");
if (null != payways && payways.length > 0 ) {
List<Long> paywayList = new ArrayList<Long>();
for (int i = 0 ; i < payways.length ; i ++) {
paywayList.add(Long.parseLong(payways[i]));
}
record.setPayWayList(paywayList);
}
}
if (StringUtils.isNotBlank(record.getFeesIdStr())) {
String[] feesIdss = record.getFeesIdStr().split(",");
if (null != feesIdss && feesIdss.length > 0 ) {
List<Long> feesIdList = new ArrayList<Long>();
for (int i = 0 ; i < feesIdss.length ; i ++) {
feesIdList.add(Long.parseLong(feesIdss[i]));
}
record.setFeesIdList(feesIdList);
}
}
List<Long> queryMerchantIds = new ArrayList<Long>();
if (StringUtils.isNotBlank(record.getShopNumber())
|| null != record.getBuilding() || null != record.getFloor()) {
//根据店铺去找到商户
WxShop sq = new WxShop();
sq.updateTenantInfo(record);
sq.setShopNumber(record.getShopNumber());
sq.setBuilding(record.getBuilding());
sq.setFloor(record.getFloor());
List<Long> merchantIds = wxShopService.getMerchantIds(sq);
if (null == merchantIds || merchantIds.size() <= 0 ) {
record.setId(-1L);
}else {
queryMerchantIds.addAll(merchantIds);
}
}
if (StringUtils.isNotBlank(record.getMerchantName())) {
WxMerchant mq = new WxMerchant();
mq.updateTenantInfo(record);
mq.setName(record.getMerchantName());
List<Long> mids = wxMerchantService.findIdList(mq);
if (null == mids || mids.size() <= 0 ) {
record.setId(-1L);
}else {
if (queryMerchantIds.size() > 0 ) {
queryMerchantIds.retainAll(mids);
}else {
queryMerchantIds.addAll(mids);
}
}
}
if (queryMerchantIds.size() > 0 ) {
record.setMerchantIdList(queryMerchantIds);
}
}
@Override
public List<WxFinanceReceive> findReceiveList(WxFinanceReceive record) {
initQueryParam(record);
@@ -777,6 +887,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
frbs.setBillId(bill.getId());
frbs.setBillType(bill.getBillType());
frbs.setFeesId(bill.getEnergyFeesId());
frbs.setType(addreceive.getType());
frbs.setPayWay(payway);
frbs.setReceive(receiveMoney);
frbs.setPay(payMoeny);


+ 55
- 15
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -100,6 +100,7 @@ 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.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
@@ -2170,6 +2171,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
WxRentContractRevenueSales sales = new WxRentContractRevenueSales();
sales.updateTenantInfo(wxRentContract);
sales.setRentContractId(wxRentContract.getId());
if (null != wxRentContract.getYearsBegin() && null != wxRentContract.getYearsEnd()) {
sales.setStarttime(wxRentContract.getYearsBegin());
sales.setEndtime(wxRentContract.getYearsEnd());
}
return wxRentContractRevenueSalesMapper.findList(sales);
}
@@ -2362,8 +2367,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
public static void main(String[] args) {
Date startDate = DateUtils.stringToDate("2024-08-01 00:00:00", DateUtils.DATE_TIME_PATTERN);
Date endDate = DateUtils.stringToDate("2024-09-11 23:59:59", DateUtils.DATE_TIME_PATTERN);
Date startDate = DateUtils.stringToDate("2023-12-20 00:00:00", DateUtils.DATE_TIME_PATTERN);
Date endDate = DateUtils.stringToDate("2024-12-19 00:00:00", DateUtils.DATE_TIME_PATTERN);
int days = DateUtils.daysBetween(startDate, endDate)+1;
System.out.println(days);
Date realEndStart = DateUtils.getDaySet(endDate, Calendar.SECOND, 1);
int[] diffs = DateUtils.getDiff(startDate, realEndStart);
Date preextraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate);
@@ -2447,10 +2455,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return bs;
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
@Override
public WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract, String sales, Long billId, Long propertyContractId) {
//如果账单存在缴费,付款,减免,冲抵,等情况,则不允许。
WxAllBill rentBill = wxAllBillMapper.selectById(billId, rentcontract.getTenantId());
if ((StringUtils.isNotBlank(rentBill.getPay()) && new BigDecimal(rentBill.getPay()).compareTo(new BigDecimal(0)) > 0 )
|| (StringUtils.isNotBlank(rentBill.getSetOff()) && new BigDecimal(rentBill.getSetOff()).compareTo(new BigDecimal(0)) > 0 )
|| (StringUtils.isNotBlank(rentBill.getReturnPay()) && new BigDecimal(rentBill.getReturnPay()).compareTo(new BigDecimal(0)) > 0 )
|| (StringUtils.isNotBlank(rentBill.getUseMoney()) && new BigDecimal(rentBill.getUseMoney()).compareTo(new BigDecimal(0)) > 0 ) ) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"账单存在已经已经缴费或付款,扣减,减免,冲抵的情况,不允许操作");
}
BigDecimal salesDeciaml = new BigDecimal(sales);
//删除自动创建的账单
@@ -2581,7 +2597,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
rs.setRentContractId(rentcontract.getId());
rs.setBillId(billId);
List<WxRentContractRevenueSales> saleList = wxRentContractRevenueSalesMapper.findList(rs);
if (null != saleList && saleList.size() > 0 ) { WxRentContractRevenueSales sale = saleList.get(0);
if (null != saleList && saleList.size() > 0 ) { WxRentContractRevenueSales sale = saleList.get(0);
sale.setCalcuteMoney(needpay);
sale.setSaleMoney(sales);
sale.setSaleMoneyValid(saleDecimalValid.toPlainString());
sale.setUpdateTime(new Date());
@@ -2592,6 +2609,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
sale.setId(idWorker.nextId());
sale.updateTenantInfo(rentcontract);
sale.setBillId(billId);
sale.setStarttime(rentBill.getStarttime());
sale.setEndtime(rentBill.getEndtime());
sale.setRentContractId(rentcontract.getId());
sale.setBillMoney(rentBill.getReceivePay());
sale.setSaleMoney(sales);
@@ -2653,7 +2672,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
sb.append(" 租金原合同租金金额:"+rentBill.getNeedPay()+"元,分摊比率为:"+rentRate+",计算之后为:"+rentneedpay+"元。");
rentBill.setMoneyChangeDetail(sb.toString());
rentBill.setReceivePay(rentneedpay);
rentBill.setBillRemark("设置销售额,自动计算");
rentBill.setBillRemark(createFrom.getMessage()+",自动计算:"+sb.toString());
rentBill.setUpdatetime(new Date());
if (new BigDecimal(rentBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) {
//rentBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode());
@@ -2705,7 +2724,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bmbill = bmbillList.get(0);
bmbill.setMoneyChangeDetail("原合同商业管理费金额:"+bmbill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。");
bmbill.setReceivePay(bussinessmoney);
bmbill.setBillRemark("设置销售额,自动计算");
bmbill.setBillRemark(createFrom.getMessage()+",自动计算。"+"原合同商业管理费金额:"+bmbill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。");
if (new BigDecimal(bmbill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) {
//bmbill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode());
}else {
@@ -2733,7 +2752,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bmbill.setPay("0");
bmbill.setStarttime(rentBill.getStarttime());
bmbill.setEndtime(rentBill.getEndtime());
bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建");
bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,总计分摊比率为:"+rate);
bmbill.setExtraCreateFrom(createFrom.getCode());
bmbill.setMoneyChangeDetail("自动计算创建,总计分摊比率为:"+rate+",应收金额为:"+bussinessmoney+"元,");
wxAllBillMapper.insert(bmbill);
@@ -2749,7 +2768,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if (null != propertyBill ) {
propertyBill.setMoneyChangeDetail("原合同商业管理费金额:"+propertyBill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。");
propertyBill.setReceivePay(bussinessmoney);
propertyBill.setBillRemark("设置销售额,自动计算");
propertyBill.setBillRemark(createFrom.getMessage()+",自动计算"+"原合同商业管理费金额:"+propertyBill.getNeedPay()+"元,总计分摊比率为:"+rate+",计算调整为:"+bussinessmoney+"元。");
if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) {
//propertyBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode());
}else {
@@ -2779,7 +2798,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bmbill.setPay("0");
bmbill.setStarttime(rentBill.getStarttime());
bmbill.setEndtime(rentBill.getEndtime());
bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建");
bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,总计分摊比率为:"+rate);
bmbill.setExtraCreateFrom(createFrom.getCode());
bmbill.setMoneyChangeDetail("自动计算创建,总计分摊比率为:"+rate+",应收金额为:"+bussinessmoney+"元,");
wxAllBillMapper.insert(bmbill);
@@ -2809,21 +2828,32 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bmbill.setPay("0");
bmbill.setStarttime(starttime);
bmbill.setEndtime(endtime);
bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建");
bmbill.setBillRemark(createFrom.getMessage()+",自动计算创建,分摊比例为"+rate);
bmbill.setExtraCreateFrom(createFrom.getCode());
bmbill.setMoneyChangeDetail("自动计算创建,分摊比例为"+rate+",计算应收金额为:"+money+"元,");
wxAllBillMapper.insert(bmbill);
return bmbill;
}
@Override
public void setContractSalesConfirm(WxRentContract rentcontract) {
WxRentContractRevenueSales sales = new WxRentContractRevenueSales();
sales.updateTenantInfo(rentcontract);
sales.setRentContractId(rentcontract.getId());
sales.setStarttime(rentcontract.getYearsBegin());
sales.setEndtime(rentcontract.getYearsEnd());
wxRentContractRevenueSalesMapper.updateConfirm(sales);
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
@Override
public WxRentContractYearsSumVo calcuteYearsRevenueRentUp(WxRentContract rentcontract) {
//查询销售总数
WxRentContractRevenueSales rsq = new WxRentContractRevenueSales();
rsq.updateTenantInfo(rentcontract);
rsq.setRentContractId(rentcontract.getId());
rsq.setStarttime(rentcontract.getYearsBegin());
rsq.setEndtime(rentcontract.getYearsEnd());
BigDecimal sum = wxRentContractRevenueSalesMapper.findSumSalesMoneyValid(rsq);
if (null == sum || sum.compareTo(new BigDecimal(0)) <= 0 ) {
WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo();
@@ -2832,14 +2862,23 @@ public class WxRentContractServiceImpl implements WxRentContractService {
vo.setBillReceivePay("0");
return vo;
}
//更新已计算
wxRentContractRevenueSalesMapper.updateCalcute(rsq);
//删除未支付,未冲抵,未退款的之前的账单
//如果有账单已经缴费或者付款,扣减,减免,冲抵等,则不允许操作。
WxAllBill billd = new WxAllBill();
billd.updateTenantInfo(rentcontract);
billd.setRentContractId(rentcontract.getId());
//删除这个时间的,不设置结束时间,因为可能之前有了账单。,然后撤铺,结束时间虽然不一样,开始时间是一致的。
billd.setStarttimeEqual(rentcontract.getYearsBegin());
billd.setExtraCreateFrom(EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN.getCode());
Integer validCount = wxAllBillMapper.countValidBillCountByRentHuiSuan(billd);
if (null != validCount && validCount > 0 ) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"存在已经已经缴费或付款,扣减,减免,冲抵的账单,则不允许操作");
}
//删除未支付,未冲抵,未退款的之前的账单
wxAllBillMapper.deleteByRentHuiSuan(billd);
//计算跳点。
@@ -2849,7 +2888,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//销售收入不满足一年怎么算。
int yearDays = DateUtils.daysBetween(rentcontract.getYearsBegin(), rentcontract.getYearsEnd())+1;
if (yearDays == 365) {
//闰年是366
if (yearDays >= 365) {
}else {
if (rentcontract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) {
jumpRevenuePay = jumpRevenuePay.multiply(new BigDecimal(yearDays)).divide(new BigDecimal(12*rentcontract.getMonthAverageDays()),rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
@@ -2899,8 +2939,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode());
propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId());
propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode());
propertyBillq.setStarttimeEqual(rentcontract.getYearsBegin());
propertyBillq.setEndtimeEqual(rentcontract.getYearsEnd());
propertyBillq.setStarttime(rentcontract.getYearsBegin());
propertyBillq.setEndtime(rentcontract.getYearsEnd());
WxBillSum propertyBillSum = wxAllBillMapper.getBillMonthSum(propertyBillq);
if (null != propertyBillSum) {
receivepay = receivepay.add(propertyBillSum.getNeedPayNumber());


+ 2
- 0
mallinkService/src/main/java/com/iformall/utils/DateUtils.java View File

@@ -1169,8 +1169,10 @@ public class DateUtils {
bdate=sdf.parse(sdf.format(bdate));
Calendar cal = Calendar.getInstance();
cal.setTime(smdate);
cal.set(Calendar.MILLISECOND, 0);
long time1 = cal.getTimeInMillis();
cal.setTime(bdate);
cal.set(Calendar.MILLISECOND, 0);
long time2 = cal.getTimeInMillis();
long between_days=(time2-time1)/(1000*3600*24);
return Integer.parseInt(String.valueOf(between_days));


+ 6
- 0
mallinkService/src/main/resources/mapper/WxAllBillMapper.xml View File

@@ -309,6 +309,12 @@
and extra_create_from = #{extraCreateFrom} and `starttime` = #{starttimeEqual}
</delete>
<select id="countValidBillCountByRentHuiSuan" parameterType="com.iformall.domain.po.WxAllBill" resultType="Integer">
select count(1) from wx_all_bill where rent_contract_id = #{rentContractId}
and (IFNULL(`pay`,'0') &gt; 0 or IFNULL(`set_off`,'0') &gt; 0 or IFNULL(`return_pay`,'0') &gt; 0 or IFNULL(`use_money`,'0') &gt; 0)
and extra_create_from = #{extraCreateFrom} and `starttime` = #{starttimeEqual}
</select>
<delete id="deleteByRentReveneuSales" parameterType="com.iformall.domain.po.WxAllBill">
delete from wx_all_bill where extra_create_from = #{extraCreateFrom}
and IFNULL(`pay`,'0') &lt;= 0 AND IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0


+ 26
- 1
mallinkService/src/main/resources/mapper/WxFinanceReceiveBillMapper.xml View File

@@ -18,11 +18,12 @@
<result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
<result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
<result column="is_del" jdbcType="INTEGER" property="isDel"/>
<result column="type" jdbcType="INTEGER" property="type"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_type`,`fees_id`,
`pay_way`,`receive_id`,`receive`,`pay`,`merchant_id`,`starttime`,`endtime`,`is_del`
`pay_way`,`receive_id`,`receive`,`pay`,`merchant_id`,`starttime`,`endtime`,`is_del`,`type`
</sql>

<sql id="dynamicWhereConditions">
@@ -41,6 +42,30 @@
<if test=" null != receiveId ">and `receive_id` = #{receiveId}</if>
<if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
<if test=" null != isDel ">and `is_del` = #{isDel}</if>
<if test=" null != createTimeBegin ">and `create_time` &gt;= #{createTimeBegin}</if>
<if test=" null != createTimeEnd ">and `create_time` &lt;= #{createTimeEnd}</if>
<if test=" null != starttime ">and `starttime` &gt;= #{starttime}</if>
<if test=" null != endtime ">and `endtime` &lt;= #{endtime}</if>
<if test=" 1 == noReduce ">and `pay_way` != 4 </if>
<if test=" null != type ">and type = #{type} </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 != feesIdList ">
and fees_id in
<foreach collection="feesIdList" index="index" item="fidItem" open="(" separator="," close=")">
#{fidItem}
</foreach>
</if>
<if test=" null != payWayList ">
and pay_way in
<foreach collection="payWayList" index="index" item="paidItem" open="(" separator="," close=")">
#{paidItem}
</foreach>
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


+ 21
- 2
mallinkService/src/main/resources/mapper/WxRentContractRevenueSalesMapper.xml View File

@@ -10,16 +10,21 @@
<result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/>
<result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
<result column="bill_id" jdbcType="BIGINT" property="billId"/>
<result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
<result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
<result column="bill_money" jdbcType="VARCHAR" property="billMoney"/>
<result column="sale_money" jdbcType="VARCHAR" property="saleMoney"/>
<result column="sale_money_valid" jdbcType="VARCHAR" property="saleMoneyValid"/>
<result column="calcute_money" jdbcType="VARCHAR" property="calcuteMoney"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="is_confirm" jdbcType="INTEGER" property="isConfirm"/>
<result column="is_calcute" jdbcType="INTEGER" property="isCalcute"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`property_contract_id`,`bill_id`,`bill_money`,
`sale_money`,`sale_money_valid`,`calcute_money`,`remark`
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`property_contract_id`,`bill_id`,`starttime`,`endtime`,`bill_money`,
`sale_money`,`sale_money_valid`,`calcute_money`,`remark`,`is_confirm`,`is_calcute`
</sql>

<sql id="dynamicWhereConditions">
@@ -34,6 +39,10 @@
<if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
<if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
<if test=" null != billId ">and `bill_id` = #{billId}</if>
<if test=" null != starttime ">and `starttime` &gt;= #{starttime}</if>
<if test=" null != endtime ">and `endtime` &lt;= #{endtime}</if>
<if test=" null != isConfirm ">and `is_confirm` = #{isConfirm}</if>
<if test=" null != isCalcute ">and `is_calcute` = #{isCalcute}</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -68,5 +77,15 @@
<include refid="dynamicWhereConditions"/>
</select>
<update id= "updateConfirm" parameterType="com.iformall.domain.po.WxRentContractRevenueSales">
update wx_rent_contract_revenue_sales set is_confirm = 1
where `tenant_id` = #{tenantId} and `rent_contract_id` = #{rentContractId} and `starttime` &gt;= #{starttime} and `endtime` &lt;= #{endtime}
</update>
<update id= "updateCalcute" parameterType="com.iformall.domain.po.WxRentContractRevenueSales">
update wx_rent_contract_revenue_sales set is_calcute = 1
where `tenant_id` = #{tenantId} and `rent_contract_id` = #{rentContractId} and `starttime` &gt;= #{starttime} and `endtime` &lt;= #{endtime}
</update>
</mapper>


Loading…
Cancel
Save