| @@ -4,4 +4,5 @@ ALTER TABLE wx_property_contract ADD COLUMN shop_numbers VARCHAR(100) COMMENT ' | |||
| ALTER TABLE wx_rent_contract ADD COLUMN price_detail TEXT COMMENT '费用详细说明' AFTER rent_price; | |||
| ALTER TABLE wx_property_contract ADD COLUMN price_detail TEXT COMMENT '费用详细说明' AFTER rent_price; | |||
| ALTER TABLE wx_property_contract ADD COLUMN fees_standards_info TEXT COMMENT '其他标准费用信息' ; | |||
| ALTER TABLE wx_property_contract ADD COLUMN parent_bill_id bigint(20) COMMENT '主账单id' ; | |||
| @@ -99,6 +99,9 @@ public class WxBillProperty extends WxBillBaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments") | |||
| private String comments; | |||
| @io.swagger.annotations.ApiModelProperty(value="主物业账单ID",name="parentBillId") | |||
| private Long parentBillId; | |||
| @TableField(exist = false) | |||
| private Integer allPeriod; | |||
| @@ -15,5 +15,6 @@ public class WxBillFeesStandardsListVo implements Serializable { | |||
| private Date end; | |||
| private Date receiveDate; | |||
| private WxFeesStandards feeStandards; | |||
| private Long parentBillId; | |||
| } | |||
| @@ -477,7 +477,7 @@ public class WxRentContractHelper { | |||
| } | |||
| //其他标准计费项 | |||
| public static List<WxBillFeesStandardsListVo> getStandardsBillList(List<WxFeesStandards> feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed) { | |||
| public static List<WxBillFeesStandardsListVo> getStandardsBillList(Integer decimalSize,List<WxFeesStandards> feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed) { | |||
| if (null == feesStandarsList || feesStandarsList.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| @@ -491,6 +491,7 @@ public class WxRentContractHelper { | |||
| if (fees.getFixedPrice().intValue() == EnumYesOrNo.YES.getCode().intValue() && null != billStartDate && null != billEndDate) { | |||
| vo.setStart(billStartDate); | |||
| vo.setEnd(billEndDate); | |||
| vo.setTotal(fees.calcuteTotalMoney(decimalSize, billStartDate, billEndDate, "1")); | |||
| vo.setReceiveDate(DateUtils.getDaySet(billStartDate,Calendar.DATE,-1)); | |||
| } | |||
| vo.setFeeStandards(fees); | |||
| @@ -445,7 +445,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| message = "更新物业合同信息成功"; | |||
| } | |||
| record.setFeeStandards(record.getFeesStardarsList()); | |||
| return new ResultData(Result.SUCCESS, message, record); | |||
| } | |||
| @@ -644,8 +644,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxPropertyContract); | |||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||
| Map<String,Object> resultMap = new HashedMap(); | |||
| List<WxBillProperty> propertyResultList = new ArrayList<>(); | |||
| List<WxBillProperty> allResultList = new ArrayList<>(); | |||
| List<WxBillProperty> resultList = new ArrayList<>(); | |||
| Date endDate = null; | |||
| if(yearList.size() > 1){ | |||
| @@ -674,7 +673,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| billEndDate = billTimeVoList.get(billTimeVoList.size()-1).getEndDate(); | |||
| } | |||
| //一次性费用的,只有一个账单。 | |||
| List<WxBillFeesStandardsListVo> fixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); | |||
| List<WxBillFeesStandardsListVo> fixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getDecimalSize(),wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); | |||
| int index = 0; | |||
| @@ -685,7 +684,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| String standarsTotal = "0"; | |||
| //非一次性费用的,跟随物业账单的周期 | |||
| List<WxBillFeesStandardsListVo> unFixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); | |||
| List<WxBillFeesStandardsListVo> unFixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getDecimalSize(),wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); | |||
| boolean flag = false; | |||
| @@ -734,51 +733,50 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| ++billcount; | |||
| //物业主账单 | |||
| WxBillProperty wxBillProperty = generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,billTimeVo.getStartDate(),billTimeVo.getEndDate(),billTimeVo.getReceiveDate(),needpay,userId,billcount,shopInfo,standarsTotal,""); | |||
| WxBillProperty wxBillProperty = generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,billTimeVo.getStartDate(),billTimeVo.getEndDate(),billTimeVo.getReceiveDate(),needpay,userId,billcount,shopInfo,standarsTotal,"",null); | |||
| //非一次性账单 | |||
| wxBillProperty.setUnFixedbillFeesStandardsList(unFixedList); | |||
| //每个非从一次性都要创建账单 | |||
| if (null != unFixedList) { | |||
| for (int j = 0 ; j < unFixedList.size(); j ++ ) { | |||
| WxBillFeesStandardsListVo svo = unFixedList.get(j); | |||
| svo.setParentBillId(wxBillProperty.getId()); | |||
| WxBillProperty property = generateBillPropertyByBillStandards(wxPayAccountBill,wxPropertyContract,isPreview,userId,svo,billcount,shopInfo); | |||
| allResultList.add(property); | |||
| resultList.add(property); | |||
| } | |||
| } | |||
| //主账单列表 | |||
| propertyResultList.add(wxBillProperty); | |||
| //所有账单列表 | |||
| allResultList.add(wxBillProperty); | |||
| resultList.add(wxBillProperty); | |||
| } | |||
| if (null != fixedList) { | |||
| for (int i = 0 ; i < fixedList.size(); i ++ ) { | |||
| WxBillFeesStandardsListVo svo = fixedList.get(i); | |||
| WxBillProperty property = generateBillPropertyByBillStandards(wxPayAccountBill,wxPropertyContract,isPreview,userId,svo,billcount,shopInfo); | |||
| allResultList.add(property); | |||
| resultList.add(property); | |||
| } | |||
| } | |||
| //批量生成预账单 | |||
| if(saveDb && allResultList.size() > 0 ) { | |||
| wxBillPropertyMapper.insertBills(allResultList); | |||
| if(saveDb && resultList.size() > 0 ) { | |||
| wxBillPropertyMapper.insertBills(resultList); | |||
| //for (int i = 0 ; i < resultList.size() ; i++) { | |||
| // wxBillPropertyMapper.insert(resultList.get(i)); | |||
| //} | |||
| } | |||
| resultMap.put("billcount",billcount); | |||
| resultMap.put("billList",propertyResultList); | |||
| resultMap.put("billList",resultList); | |||
| return resultMap; | |||
| } | |||
| private WxBillProperty generateBillPropertyByBillStandards(WxPayAccountBill wxPayAccountBill,WxPropertyContract wxPropertyContract,Integer isPreview,Long userId,WxBillFeesStandardsListVo svo, | |||
| Integer billcount,Map<String, Object> shopInfo) { | |||
| return generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,svo.getStart(),svo.getEnd(),svo.getReceiveDate(),svo.getTotal(),userId,billcount,shopInfo,"0",svo.getBillName()); | |||
| return generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,svo.getStart(),svo.getEnd(),svo.getReceiveDate(),svo.getTotal(),userId,billcount,shopInfo,"0",svo.getBillName(),svo.getParentBillId()); | |||
| } | |||
| private WxBillProperty generateBillProperty(WxPayAccountBill wxPayAccountBill,WxPropertyContract wxPropertyContract,Integer isPreview,Date start,Date end,Date receiveDate,String needpay, | |||
| Long userId,Integer billcount,Map<String, Object> shopInfo,String standarsTotal,String remark) { | |||
| Long userId,Integer billcount,Map<String, Object> shopInfo,String standarsTotal,String remark,Long parentBillId) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxBillProperty wxBillProperty = new WxBillProperty(); | |||
| wxBillProperty.setIsPreview(isPreview); | |||
| @@ -812,6 +810,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| wxBillProperty.setLatePayRatio(0); | |||
| wxBillProperty.setTotalFee(new BigDecimal(needpay).add(new BigDecimal(standarsTotal)).toPlainString()); | |||
| wxBillProperty.setComments(remark); | |||
| wxBillProperty.setParentBillId(parentBillId); | |||
| //计算手续费 | |||
| BigDecimal servicePay = new BigDecimal(wxBillProperty.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), wxPropertyContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); | |||
| @@ -2,10 +2,10 @@ | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillPropertyMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillProperty"> | |||
| <id column="id" jdbcType="INTEGER" property="id"/> | |||
| <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="property_contract_id" jdbcType="INTEGER" property="propertyContractId"/> | |||
| <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| @@ -18,9 +18,9 @@ | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="merchant_id" jdbcType="INTEGER" property="merchantId"/> | |||
| <result column="user_id" jdbcType="INTEGER" property="userId"/> | |||
| <result column="shop_id" jdbcType="INTEGER" property="shopId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="revenue" jdbcType="BIGINT" property="revenue"/> | |||
| @@ -33,6 +33,7 @@ | |||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | |||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||
| <result column="parent_bill_id" jdbcType="BIGINT" property="parentBillId"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| @@ -53,7 +54,7 @@ | |||
| `createtime`,`expired_day`,`tenant_id`,`status`,`is_del`,`need_pay`,`last_owe_call_time`,`last_owe_call_user`, | |||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`apply_status`,`apply_pay_img`,`apply_update_time`, | |||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | |||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze,service_charge_pay | |||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze,service_charge_pay,`parent_bill_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -84,6 +85,8 @@ | |||
| <if test=" null != isPreview ">and is_preview = #{isPreview}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != parentBillId ">and `parent_bill_id` = #{parentBillId}</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != propertyContractIds "> | |||
| and property_contract_id in | |||
| @@ -156,7 +159,7 @@ | |||
| <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != parentBillId ">and br.`parent_bill_id` = #{parentBillId}</if> | |||
| <if test=" 1 == notifyed ">and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6,7) )</if> | |||
| <if test=" null != propertyContractIds "> | |||
| and br.property_contract_id in | |||
| @@ -186,7 +189,7 @@ | |||
| br.`status`,br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,br.`last_owe_call_time`,br.`last_owe_call_user`, | |||
| br.`revenue`,br.`late_pay_time`,br.`property_contract_id`,br.late_pay_price,br.`shop_info`,br.pay_way,br.late_pay_status, | |||
| br.`comments`,br.starttime,br.endtime,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.freeze,br.service_charge_pay, | |||
| br.`late_pay_ratio` | |||
| br.`late_pay_ratio`,br.`parent_bill_id` | |||
| from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| @@ -367,7 +370,7 @@ | |||
| tenant_id, parent_tenant_id, status, is_del, need_pay, merchant_id, user_id, shop_id, updatetime, starttime, | |||
| endtime, | |||
| rent_shop_type, revenue, late_pay_ratio, late_pay_time, late_pay_price, period, is_preview, shop_info, | |||
| pay_way, late_pay_status, comments,service_charge_pay) | |||
| pay_way, late_pay_status, comments,service_charge_pay,parent_bill_id) | |||
| VALUES | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| @@ -376,7 +379,7 @@ | |||
| #{item.status},#{item.isDel},#{item.needPay},#{item.merchantId}, | |||
| #{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime},#{item.endtime},#{item.rentShopType},#{item.revenue}, | |||
| #{item.latePayRatio},#{item.latePayTime},#{item.latePayPrice},#{item.period},#{item.isPreview},#{item.shopInfo}, | |||
| #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay} | |||
| #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay},#{parentBillId} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||