| @@ -131,6 +131,9 @@ public class WxRentContract implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "filename") | |||
| private String filename; | |||
| @io.swagger.annotations.ApiModelProperty(value = "租期(月)", name = "lease") | |||
| private Integer lease; | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| @@ -332,6 +335,14 @@ public class WxRentContract implements Serializable { | |||
| this.filename = filename; | |||
| } | |||
| public Integer getLease() { | |||
| return lease; | |||
| } | |||
| public void setLease(Integer lease) { | |||
| this.lease = lease; | |||
| } | |||
| public static enum Field { | |||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), Price_ASC("`price` ASC"), Price_DESC("`price` DESC"), RentalStartDate_ASC("`rental_start_date` ASC"), RentalStartDate_DESC("`rental_start_date` DESC"), RentalEndDate_ASC("`rental_end_date` ASC"), RentalEndDate_DESC("`rental_end_date` DESC"), SignDate_ASC("`sign_date` ASC"), SignDate_DESC("`sign_date` DESC"), ReceivePeriod_ASC("`receive_period` ASC"), ReceivePeriod_DESC("`receive_period` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), Filepath_ASC("`filepath` ASC"), Filepath_DESC("`filepath` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ContractNumber_ASC("`contract_number` ASC"), ContractNumber_DESC("`contract_number` DESC"), Deposit_ASC("`deposit` ASC"), Deposit_DESC("`deposit` DESC"), PayDate_ASC("`pay_date` ASC"), PayDate_DESC("`pay_date` DESC"), IsDel_ASC("`is_del` ASC"), IsDel_DESC("`is_del` DESC"), MerchantName_ASC("`merchant_name` ASC"), MerchantName_DESC("`merchant_name` DESC"), Brand_ASC("`brand` ASC"), Brand_DESC("`brand` DESC"), BusinessId_ASC("`business_id` ASC"), BusinessId_DESC("`business_id` DESC"), ShopType_ASC("`shop_type` ASC"), ShopType_DESC("`shop_type` DESC"), ShopId_ASC("`shop_id` ASC"), ShopId_DESC("`shop_id` DESC"), Updatetime_ASC("`updatetime` ASC"), Updatetime_DESC("`updatetime` DESC"), Createtime_ASC("`createtime` ASC"), Createtime_DESC("`createtime` DESC"); | |||
| private String value; | |||
| @@ -257,7 +257,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()); | |||
| wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | |||
| //创建账单 | |||
| buildRent(wxMerchant); | |||
| buildRent(wxRentContract); | |||
| } | |||
| } else { | |||
| @@ -368,14 +368,12 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void buildRent(WxMerchant wxMerchant) { | |||
| public void buildRent(WxRentContract wxRentContract) { | |||
| //获取用户 | |||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||
| //根据商户ID找出合同 | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(wxMerchant.getId()); | |||
| List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | |||
| if (list.size() > 0) { | |||
| wxRentContract = list.get(0); | |||
| @@ -388,7 +386,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxBillRent.setRentContractId(wxRentContract.getId()); | |||
| wxBillRent.setReceivePay(0); | |||
| wxBillRent.setPay(0); | |||
| int needpay = wxRentContract.getPrice(); | |||
| int needpay = wxRentContract.getPrice()*100; | |||
| wxBillRent.setNeedPay(needpay); | |||
| wxBillRent.setOwe(needpay); | |||
| @@ -422,9 +420,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| } | |||
| wxBillRent.setTenantId(wxMerchant.getTenantId()); | |||
| wxBillRent.setTenantId(wxRentContract.getTenantId()); | |||
| wxBillRent.setIsDel(0); | |||
| wxBillRent.setMerchantId(wxMerchant.getId()); | |||
| wxBillRent.setMerchantId(wxRentContract.getMerchantId()); | |||
| wxBillRent.setUserId(user.getId()); | |||
| wxBillRent.setShopId(wxRentContract.getShopId()); | |||
| wxBillRent.setCreatetime(date); | |||
| @@ -67,6 +67,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| public ResultData getById(Long id) { | |||
| Map<String,Object> result=new HashMap<>(); | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); | |||
| wxRentContract.setPrice(wxRentContract.getPrice()/100); | |||
| result.put("wxRentContract",wxRentContract); | |||
| //关联的商户 | |||
| if(wxRentContract.getMerchantId()!=null){ | |||
| @@ -94,6 +95,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(record.getRentalStartDate()); | |||
| instance.add(Calendar.MONTH,record.getLease()); | |||
| instance.add(Calendar.DAY_OF_MONTH,-1); | |||
| record.setRentalEndDate(instance.getTime()); | |||
| Date date = new Date(); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| @@ -105,6 +111,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存租赁合同信息成功",record); | |||
| } else {//更新租赁合同信息 | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(record.getRentalStartDate()); | |||
| instance.add(Calendar.MONTH,record.getLease()); | |||
| instance.add(Calendar.DAY_OF_MONTH,-1); | |||
| record.setRentalEndDate(instance.getTime()); | |||
| record.setPrice(record.getPrice()*100); | |||
| record.setUpdatetime(new Date()); | |||
| try { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | |||
| @@ -152,7 +164,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRent.setRentContractId(wxRentContract.getId()); | |||
| wxBillRent.setReceivePay(0); | |||
| wxBillRent.setPay(0); | |||
| int needpay = wxRentContract.getPrice(); | |||
| int needpay = wxRentContract.getPrice()*100; | |||
| wxBillRent.setNeedPay(needpay); | |||
| wxBillRent.setOwe(needpay); | |||
| @@ -27,11 +27,12 @@ | |||
| <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/> | |||
| <result column="pay_account" jdbcType="VARCHAR" property="payAccount"/> | |||
| <result column="filename" jdbcType="VARCHAR" property="filename"/> | |||
| <result column="lease" jdbcType="INTEGER" property="lease"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`,`pay_account`,`filename` | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`,`pay_account`,`filename`,`lease` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -61,6 +62,8 @@ | |||
| <if test=" null != linkPhone ">and `link_phone` = #{linkPhone}</if> | |||
| <if test=" null != payAccount ">and `pay_account` = #{payAccount}</if> | |||
| <if test=" null != filename ">and `filename` = #{filename}</if> | |||
| <if test=" null != lease ">and `lease` = #{lease}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -80,7 +83,8 @@ | |||
| <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`, | |||
| rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName | |||
| rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName, | |||
| rc.lease | |||
| from wx_rent_contract rc | |||
| left join wx_shop s on rc.shop_id=s.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||