| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.domain.dto; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.List; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| /** | |||||
| */ | |||||
| @Data | |||||
| public class ContractJoinRenevueUpFeesDTO extends TenantEntity{ | |||||
| private static final long serialVersionUID = 7369596648187876295L; | |||||
| private BigDecimal needPay; | |||||
| private List<Long> billIds; | |||||
| } | |||||
| @@ -214,11 +214,9 @@ public class WxAllBill extends TenantEntity { | |||||
| } | } | ||||
| @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6", "坏账_7", "退租待结算_8","预收待抵扣_9"}, width = 20, orderNum = "10") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单状态EnumBillStatus", name = "status") | |||||
| public Integer status; | |||||
| @TableField(exist = false) | |||||
| public List<Integer> statusList; | |||||
| @Excel(name = "是否已删除", width = 20, orderNum = "10") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否已删除EnumYesOrNo", name = "isDel") | |||||
| public Integer isDel; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "费用科目", name = "energyFeesId") | @io.swagger.annotations.ApiModelProperty(value = "费用科目", name = "energyFeesId") | ||||
| public Long energyFeesId; | public Long energyFeesId; | ||||
| @@ -283,6 +281,9 @@ public class WxAllBill extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单额外生成来源EnumBillExtraCreateFrom", name = "extraCreateFrom") | @io.swagger.annotations.ApiModelProperty(value = "账单额外生成来源EnumBillExtraCreateFrom", name = "extraCreateFrom") | ||||
| private Integer extraCreateFrom; | private Integer extraCreateFrom; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否参与扣点计算EnumYesOrNo", name = "isJoinRenevue") | |||||
| private Integer isJoinRenevue; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "计费面积", name = "rentArea") | @io.swagger.annotations.ApiModelProperty(value = "计费面积", name = "rentArea") | ||||
| private String rentArea; | private String rentArea; | ||||
| @@ -399,4 +400,6 @@ public class WxAllBill extends TenantEntity { | |||||
| private String queryShopIdStr; | private String queryShopIdStr; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long orginContractId; | private Long orginContractId; | ||||
| @TableField(exist = false) | |||||
| private Integer queryNeedHuiSuanBills; | |||||
| } | } | ||||
| @@ -16,6 +16,7 @@ import java.util.List; | |||||
| public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> { | public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> { | ||||
| List<WxAllBill> findList(WxAllBill wxBillRent); | List<WxAllBill> findList(WxAllBill wxBillRent); | ||||
| List<Long> findIdList(WxAllBill wxBillRent); | |||||
| List<Long> queryBillRentContractIdList(WxAllBill record); | List<Long> queryBillRentContractIdList(WxAllBill record); | ||||
| List<WxAllBill> findContractSamePeriodSum(WxAllBill wxBillRent); | List<WxAllBill> findContractSamePeriodSum(WxAllBill wxBillRent); | ||||
| @@ -36,6 +37,9 @@ public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> { | |||||
| Integer countValidBillCountByRentHuiSuan(WxAllBill wxBillRent); | Integer countValidBillCountByRentHuiSuan(WxAllBill wxBillRent); | ||||
| void deleteByRentReveneuSales(WxAllBill wxBillRent); | void deleteByRentReveneuSales(WxAllBill wxBillRent); | ||||
| void setIsDel(@Param("tenantId")String tenantId, @Param("list")List<Long> ids, @Param("isDel")Integer isDel,@Param("oldIsDel")Integer oldIsDel); | |||||
| void setIsJoinRenevue(@Param("tenantId")String tenantId, @Param("isJoinRenevue")Integer isJoinRenevue, @Param("feesId")Long feesId,@Param("rentContractId")Long rentContractId); | |||||
| void updatePreviewStatus(WxAllBill record); | void updatePreviewStatus(WxAllBill record); | ||||
| void insertBills(@Param("tenantId")String tenantId, @Param("list")List<WxAllBill> resultList); | void insertBills(@Param("tenantId")String tenantId, @Param("list")List<WxAllBill> resultList); | ||||
| @@ -975,9 +975,13 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { | |||||
| return wxRentContractRevenueJumpMapper.findList(jump); | return wxRentContractRevenueJumpMapper.findList(jump); | ||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| @Override | @Override | ||||
| public void setJoinRenevueUp(WxRentContractAgileUnDeposit unDeposit) { | public void setJoinRenevueUp(WxRentContractAgileUnDeposit unDeposit) { | ||||
| wxRentContractAgileUnDepositMapper.updateJoinRenevueUp(unDeposit); | wxRentContractAgileUnDepositMapper.updateJoinRenevueUp(unDeposit); | ||||
| //设置款项账单是否参与提成计算。 | |||||
| WxRentContractAgileUnDeposit aud = wxRentContractAgileUnDepositMapper.selectById(unDeposit.getId(),unDeposit.getTenantId()); | |||||
| wxAllBillMapper.setIsJoinRenevue(aud.getTenantId(),unDeposit.getJoinRenevueUp(),aud.getFeesId(),aud.getRentContractId()); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -10,6 +10,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.common.SysConfigConstant; | import com.iformall.common.SysConfigConstant; | ||||
| import com.iformall.domain.dto.ContractJoinRenevueUpFeesDTO; | |||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.SysConfig; | import com.iformall.domain.po.SysConfig; | ||||
| import com.iformall.domain.po.WxAllBill; | import com.iformall.domain.po.WxAllBill; | ||||
| @@ -1027,23 +1028,42 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| }else { | }else { | ||||
| sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",扣点规则计算金额:"+needpay+"."); | sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",扣点规则计算金额:"+needpay+"."); | ||||
| } | } | ||||
| BigDecimal uneedPay = getJoinRenevueUpFeesReceivePayTotal(rentcontract,startime,endtime,true); | |||||
| if (null != uneedPay && uneedPay.compareTo(new BigDecimal(0)) > 0 ){ | |||||
| sb.append("参与取高款项计算金额:"+uneedPay.toPlainString()); | |||||
| if (uneedPay.compareTo(new BigDecimal(needpay)) > 0 ) { | |||||
| needpay = uneedPay.toPlainString(); | |||||
| boolean createNewBill = true; | |||||
| ContractJoinRenevueUpFeesDTO dto = getJoinRenevueUpFeesReceivePayTotal(rentcontract,startime,endtime); | |||||
| if (null != dto) { | |||||
| BigDecimal uneedPay = dto.getNeedPay(); | |||||
| if (null != uneedPay && uneedPay.compareTo(new BigDecimal(0)) > 0 ){ | |||||
| sb.append("参与取高款项计算金额:"+uneedPay.toPlainString()); | |||||
| if (uneedPay.compareTo(new BigDecimal(needpay)) >= 0 ) { | |||||
| //取高比扣点高 | |||||
| createNewBill = false; | |||||
| needpay = uneedPay.toPlainString(); | |||||
| //此处取高的比提成高,如果之前有将参与取高的账单设置为已删除,则需要恢复 | |||||
| wxAllBillMapper.setIsDel(rentcontract.getTenantId(),dto.getBillIds(),EnumYesOrNo.NO.getCode(),EnumYesOrNo.YES.getCode()); | |||||
| }else { | |||||
| //取高比扣点低 | |||||
| if (null != dto.getBillIds() && dto.getBillIds().size() > 0 ) { | |||||
| //如果提成的比参与取高的款项高,将这些参与取高的账单设置为已删除 | |||||
| wxAllBillMapper.setIsDel(rentcontract.getTenantId(),dto.getBillIds(),EnumYesOrNo.YES.getCode(),null); | |||||
| } | |||||
| } | |||||
| }else { | |||||
| //无取高费用 | |||||
| if (null != dto.getBillIds() && dto.getBillIds().size() > 0 ) { | |||||
| //如果提成的比参与取高的款项高,将这些参与取高的账单设置为已删除 | |||||
| wxAllBillMapper.setIsDel(rentcontract.getTenantId(),dto.getBillIds(),EnumYesOrNo.YES.getCode(),null); | |||||
| } | |||||
| } | } | ||||
| sb.append("取高后总金额为:["+needpay+"]."); | |||||
| } | } | ||||
| sb.append("取高后总金额为:["+needpay+"]."); | |||||
| //保存销售额 | //保存销售额 | ||||
| addRevenueSales(rentcontract,startime,endtime,needpay,sales,saleDecimalValid); | addRevenueSales(rentcontract,startime,endtime,needpay,sales,saleDecimalValid); | ||||
| return handleBills(user,sb,rentcontract,needpay,startime,endtime,EnumBillExtraCreateFrom.RNET_REVENUE_SALES); | |||||
| return handleBills(createNewBill,user,sb,rentcontract,needpay,startime,endtime,EnumBillExtraCreateFrom.RNET_REVENUE_SALES); | |||||
| } | } | ||||
| } | } | ||||
| private BigDecimal getJoinRenevueUpFeesReceivePayTotal(WxRentContract rentcontract,Date begin,Date end,boolean isEqualTime) { | |||||
| private ContractJoinRenevueUpFeesDTO getJoinRenevueUpFeesReceivePayTotal(WxRentContract rentcontract,Date begin,Date end) { | |||||
| //如果是取高的,则取高计算 | //如果是取高的,则取高计算 | ||||
| if (rentcontract.getType().intValue() == EnumAgileContractType.RENEVUE_UP.getCode().intValue()) { | if (rentcontract.getType().intValue() == EnumAgileContractType.RENEVUE_UP.getCode().intValue()) { | ||||
| //查询所有参与取高的款项的账单 | //查询所有参与取高的款项的账单 | ||||
| @@ -1057,21 +1077,35 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| udbill.updateTenantInfo(rentcontract); | udbill.updateTenantInfo(rentcontract); | ||||
| udbill.setRentContractId(rentcontract.getId()); | udbill.setRentContractId(rentcontract.getId()); | ||||
| udbill.setIsPreview(EnumYesOrNo.NO.getCode()); | udbill.setIsPreview(EnumYesOrNo.NO.getCode()); | ||||
| //此处应该查询所有的,因为有可能是是重新录入销售额,之前的账单已经被设位置已删除 | |||||
| //udbill.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| udbill.setEnergyFeesIds(udlist); | udbill.setEnergyFeesIds(udlist); | ||||
| if (isEqualTime) { | |||||
| udbill.setStarttimeEqual(begin); | |||||
| udbill.setEndtimeEqual(end); | |||||
| }else { | |||||
| udbill.setStarttime(rentcontract.getYearsBegin()); | |||||
| udbill.setEndtime(rentcontract.getYearsEnd()); | |||||
| }; | |||||
| udbill.setIsJoinRenevue(EnumYesOrNo.YES.getCode()); | |||||
| udbill.setStarttimeEqual(begin); | |||||
| udbill.setEndtimeEqual(end); | |||||
| BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill); | BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill); | ||||
| return uneedPay; | |||||
| ContractJoinRenevueUpFeesDTO dto = new ContractJoinRenevueUpFeesDTO(); | |||||
| dto.setNeedPay(uneedPay); | |||||
| dto.setBillIds(wxAllBillMapper.findIdList(udbill)); | |||||
| return dto; | |||||
| } | } | ||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| private BigDecimal getAllRenevueBillsReceivePayTotal(WxRentContract rentcontract,Date begin,Date end) { | |||||
| WxAllBill udbill = new WxAllBill(); | |||||
| udbill.updateTenantInfo(rentcontract); | |||||
| udbill.setRentContractId(rentcontract.getId()); | |||||
| udbill.setIsPreview(EnumYesOrNo.NO.getCode()); | |||||
| udbill.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| udbill.setQueryNeedHuiSuanBills(EnumYesOrNo.YES.getCode()); | |||||
| udbill.setStarttime(begin); | |||||
| udbill.setEndtime(end); | |||||
| BigDecimal uneedPay = wxAllBillMapper.getReceivePaySum(udbill); | |||||
| return uneedPay; | |||||
| } | |||||
| private void addRevenueSales(WxRentContract rentcontract,Date starttime,Date endtime,String needpay,String sales,BigDecimal saleDecimalValid) { | private void addRevenueSales(WxRentContract rentcontract,Date starttime,Date endtime,String needpay,String sales,BigDecimal saleDecimalValid) { | ||||
| WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); | WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); | ||||
| rs.updateTenantInfo(rentcontract); | rs.updateTenantInfo(rentcontract); | ||||
| @@ -1103,37 +1137,39 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| private WxRentContractRevenueSetSalesVo handleBills(MallUserInfo user,StringBuffer sb,WxRentContract rentcontract, String needpay,Date startDate,Date endDate, | |||||
| private WxRentContractRevenueSetSalesVo handleBills(boolean createNewBill,MallUserInfo user,StringBuffer sb,WxRentContract rentcontract, String needpay,Date startDate,Date endDate, | |||||
| EnumBillExtraCreateFrom createFrom) { | EnumBillExtraCreateFrom createFrom) { | ||||
| //根据设置的比例海生成对应的账单. | |||||
| List<WxRentContractAgileRenevueFees> fees = wxAgileContractService.findRenevueFeesListByContract(rentcontract.getId(), rentcontract); | |||||
| if (null == fees) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"没有设置扣点款项"); | |||||
| } | |||||
| List<Long> shopIdList = rentcontract.shopIdsByRentInfo(); | |||||
| Map<Long, BigDecimal> shopAreaRateMap = rentcontract.getRentShopArea(); | |||||
| WxShopUsers suq = new WxShopUsers(); | |||||
| suq.updateTenantInfo(rentcontract); | |||||
| suq.setShopIds(shopIdList); | |||||
| suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); | |||||
| Map<Long,WxShopUsers> shopUserMap = wxShopService.getShopUserMap(suq); | |||||
| WxShop sq = new WxShop(); | |||||
| sq.updateTenantInfo(sq); | |||||
| sq.setIds(shopIdList); | |||||
| Map<Long, WxShop> shopMap = wxShopService.findShopMap(sq); | |||||
| List<WxAllBill> allbill = new ArrayList<WxAllBill>(); | |||||
| for (int i = 0 ; i < fees.size(); i++ ) { | |||||
| WxRentContractAgileRenevueFees fee = fees.get(i); | |||||
| //更新账单费用 | |||||
| BigDecimal fneedpay = new BigDecimal(needpay).multiply(new BigDecimal(fee.getRate()).divide(new BigDecimal(100))).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); | |||||
| List<WxAllBill> renBill = generateRenevueBill(fee.getFeesId(),user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract,fneedpay,fee.getRate(),startDate,endDate,createFrom); | |||||
| allbill.addAll(renBill); | |||||
| } | |||||
| WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); | WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); | ||||
| vo.setTotal(needpay); | vo.setTotal(needpay); | ||||
| vo.setBillList(allbill);; | |||||
| if (createNewBill) { | |||||
| //根据设置的比例海生成对应的账单. | |||||
| List<WxRentContractAgileRenevueFees> fees = wxAgileContractService.findRenevueFeesListByContract(rentcontract.getId(), rentcontract); | |||||
| if (null == fees) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"没有设置扣点款项"); | |||||
| } | |||||
| List<Long> shopIdList = rentcontract.shopIdsByRentInfo(); | |||||
| Map<Long, BigDecimal> shopAreaRateMap = rentcontract.getRentShopArea(); | |||||
| WxShopUsers suq = new WxShopUsers(); | |||||
| suq.updateTenantInfo(rentcontract); | |||||
| suq.setShopIds(shopIdList); | |||||
| suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); | |||||
| Map<Long,WxShopUsers> shopUserMap = wxShopService.getShopUserMap(suq); | |||||
| WxShop sq = new WxShop(); | |||||
| sq.updateTenantInfo(sq); | |||||
| sq.setIds(shopIdList); | |||||
| Map<Long, WxShop> shopMap = wxShopService.findShopMap(sq); | |||||
| List<WxAllBill> allbill = new ArrayList<WxAllBill>(); | |||||
| for (int i = 0 ; i < fees.size(); i++ ) { | |||||
| WxRentContractAgileRenevueFees fee = fees.get(i); | |||||
| //更新账单费用 | |||||
| BigDecimal fneedpay = new BigDecimal(needpay).multiply(new BigDecimal(fee.getRate()).divide(new BigDecimal(100))).setScale(rentcontract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); | |||||
| List<WxAllBill> renBill = generateRenevueBill(fee.getFeesId(),user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract,fneedpay,fee.getRate(),startDate,endDate,createFrom); | |||||
| allbill.addAll(renBill); | |||||
| } | |||||
| vo.setBillList(allbill);; | |||||
| } | |||||
| return vo; | return vo; | ||||
| } | } | ||||
| @@ -1256,12 +1292,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| //查询所有参与取高的账单金额 | |||||
| BigDecimal receivepay = getJoinRenevueUpFeesReceivePayTotal(rentcontract,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),false); | |||||
| //查询未删除的参与扣点计算的非押金账单或者录入销售额生成的账单之和 | |||||
| BigDecimal receivepay = getAllRenevueBillsReceivePayTotal(rentcontract,rentcontract.getYearsBegin(),rentcontract.getYearsEnd()); | |||||
| if (null == receivepay ){ | if (null == receivepay ){ | ||||
| receivepay = new BigDecimal(0); | receivepay = new BigDecimal(0); | ||||
| } | } | ||||
| WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo(); | WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo(); | ||||
| vo.setTotalSales(sum.toPlainString()); | vo.setTotalSales(sum.toPlainString()); | ||||
| vo.setTotalRevenue(jumpRevenuePay.toPlainString()); | vo.setTotalRevenue(jumpRevenuePay.toPlainString()); | ||||
| @@ -1277,7 +1313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) { | private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) { | ||||
| StringBuffer sb = new StringBuffer(""); | StringBuffer sb = new StringBuffer(""); | ||||
| return handleBills(user,sb,rentcontract,owe,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN); | |||||
| return handleBills(true,user,sb,rentcontract,owe,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN); | |||||
| } | } | ||||
| @@ -25,7 +25,6 @@ | |||||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | ||||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | ||||
| <result column="period" jdbcType="VARCHAR" property="period"/> | <result column="period" jdbcType="VARCHAR" property="period"/> | ||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | ||||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | ||||
| <result column="bill_remark" jdbcType="VARCHAR" property="billRemark"/> | <result column="bill_remark" jdbcType="VARCHAR" property="billRemark"/> | ||||
| @@ -46,14 +45,16 @@ | |||||
| <result column="can_edit" jdbcType="INTEGER" property="canEdit" /> | <result column="can_edit" jdbcType="INTEGER" property="canEdit" /> | ||||
| <result column="cus_name" jdbcType="VARCHAR" property="cusName" /> | <result column="cus_name" jdbcType="VARCHAR" property="cusName" /> | ||||
| <result column="fees_type" jdbcType="INTEGER" property="feesType"/> | <result column="fees_type" jdbcType="INTEGER" property="feesType"/> | ||||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||||
| <result column="is_join_renevue" jdbcType="INTEGER" property="isJoinRenevue"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`shop_id`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, | `id`,`tenant_id`,`parent_tenant_id`,`shop_id`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, | ||||
| `price_detail`,`need_pay`,`receive_pay`,`history_receive_pay`,`pay`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`, | |||||
| `price_detail`,`need_pay`,`receive_pay`,`history_receive_pay`,`pay`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`energy_fees_id`, | |||||
| `return_pay`,`bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`receive_date`,`period`, | `return_pay`,`bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`receive_date`,`period`, | ||||
| `is_preview`,`shop_info`,`rent_contract_id`,`rent_contract_agile_fees_type`,`parent_bill_id`,`virtual_compose_id`,`parent_virtual_compose_id`, | `is_preview`,`shop_info`,`rent_contract_id`,`rent_contract_agile_fees_type`,`parent_bill_id`,`virtual_compose_id`,`parent_virtual_compose_id`, | ||||
| `energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,`can_edit`,`cus_name`,`fees_type` | |||||
| `energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,`can_edit`,`cus_name`,`fees_type`,`is_del`,`is_join_renevue` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -64,7 +65,8 @@ | |||||
| <if test=" null != createBy ">and `create_by` = #{createBy}</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 != createByName and '' != createByName"> and `create_by_name` like concat('%',#{createByName},'%')</if> | ||||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | ||||
| <if test=" null != status ">and `status` = #{status}</if> | |||||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||||
| <if test=" null != isJoinRenevue ">and `is_join_renevue` = #{isJoinRenevue}</if> | |||||
| <if test=" null != feesType ">and `fees_type` = #{feesType}</if> | <if test=" null != feesType ">and `fees_type` = #{feesType}</if> | ||||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | ||||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | ||||
| @@ -108,6 +110,9 @@ | |||||
| <if test=" 1 == notifyed "> | <if test=" 1 == notifyed "> | ||||
| and (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 ) | and (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 ) | ||||
| </if> | </if> | ||||
| <if test=" 1 == queryNeedHuiSuanBills "> | |||||
| and ( (`is_join_renevue` = 1 and extra_create_from is null ) or extra_create_from = 2 ) | |||||
| </if> | |||||
| <if test=" 1 == hasParentBillId ">and `parent_bill_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=" 0 == hasParentBillId ">and `parent_bill_id` is null</if> | ||||
| <if test=" null != energyReadingCalcuteId ">and `energy_reading_calcuteId` = #{energyReadingCalcuteId}</if> | <if test=" null != energyReadingCalcuteId ">and `energy_reading_calcuteId` = #{energyReadingCalcuteId}</if> | ||||
| @@ -171,6 +176,11 @@ | |||||
| from wx_all_bill | from wx_all_bill | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long"> | |||||
| select id | |||||
| from wx_all_bill | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="getShopIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long"> | <select id="getShopIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long"> | ||||
| select distinct shop_id | select distinct shop_id | ||||
| @@ -360,6 +370,21 @@ | |||||
| and rent_contract_id = #{rentContractId} | and rent_contract_id = #{rentContractId} | ||||
| </if> | </if> | ||||
| </delete> | </delete> | ||||
| <update id="setIsDel" parameterType="HashMap"> | |||||
| update wx_all_bill set is_del = #{isDel} where id in | |||||
| <foreach collection="list" item="item" index="index" separator=","> | |||||
| (#{item}) | |||||
| </foreach> | |||||
| <if test=" null != oldIsDel"> | |||||
| and is_del = #{oldIsDel} | |||||
| </if> | |||||
| </update> | |||||
| <update id="setIsJoinRenevue" parameterType="HashMap"> | |||||
| update wx_all_bill set is_join_renevue = #{isJoinRenevue} where rent_contract_id = #{rentContractId} | |||||
| and energy_fees_id = #{feesId} and extra_create_from is null | |||||
| </update> | |||||
| <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxAllBill"> | <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxAllBill"> | ||||
| update wx_all_bill set is_preview = #{isPreview} | update wx_all_bill set is_preview = #{isPreview} | ||||
| @@ -378,11 +403,11 @@ | |||||
| #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.shopId},#{item.createtime}, | #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.shopId},#{item.createtime}, | ||||
| #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.priceDetail}, | #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.priceDetail}, | ||||
| #{item.needPay},#{item.receivePay},#{item.historyReceivePay},#{item.pay},#{item.payWay},#{item.payDate},#{item.setOff},#{item.useMoney}, | #{item.needPay},#{item.receivePay},#{item.historyReceivePay},#{item.pay},#{item.payWay},#{item.payDate},#{item.setOff},#{item.useMoney}, | ||||
| #{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark}, | |||||
| #{item.starttime},#{item.endtime},#{item.energyFeesId},#{item.returnPay},#{item.billRemark}, | |||||
| #{item.lastOweCallTime},#{item.lastOweCallUser}, | #{item.lastOweCallTime},#{item.lastOweCallUser}, | ||||
| #{item.receiveDate},#{item.period},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.rentContractAgileFeesType}, | #{item.receiveDate},#{item.period},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.rentContractAgileFeesType}, | ||||
| #{item.parentBillId},#{item.virtualComposeId},#{item.parentVirtualComposeId},#{item.energyReadingCalcuteId}, | #{item.parentBillId},#{item.virtualComposeId},#{item.parentVirtualComposeId},#{item.energyReadingCalcuteId}, | ||||
| #{item.energyReadingId},#{item.extraCreateFrom},#{item.rentArea},#{item.canEdit},#{item.cusName},#{item.feesType} | |||||
| #{item.energyReadingId},#{item.extraCreateFrom},#{item.rentArea},#{item.canEdit},#{item.cusName},#{item.feesType},#{item.isDel},#{item.isJoinRenevue} | |||||
| ) | ) | ||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||