From b35e64d4002e5f994ec4471b79a222edb420ce09 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 14 Jan 2019 11:22:16 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[=E7=A7=9F=E8=B5=81=E5=90=88=E5=90=8C][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8F=8A=E7=94=9F=E6=88=90=E8=B4=A6=E5=8D=95]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/domain/po/WxRentContract.java | 8 +- .../enums/EnumRentContractAdjustPeriod.java | 37 ++++ .../impl/WxRentContractServiceImpl.java | 204 +++++++++++------- 3 files changed, 168 insertions(+), 81 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustPeriod.java diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index cc827da5b..1d5529d2f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -163,9 +163,9 @@ public class WxRentContract implements Serializable { private Integer type; @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") - private Integer adjustRatio; + private String adjustRatio; - @io.swagger.annotations.ApiModelProperty(value = "调整周期", name = "adjustPeriod") + @io.swagger.annotations.ApiModelProperty(value = "计租周期 1日2月", name = "adjustPeriod") private Integer adjustPeriod; @io.swagger.annotations.ApiModelProperty(value = "支付比例", name = "payRatio") @@ -408,11 +408,11 @@ public class WxRentContract implements Serializable { this.type = type; } - public Integer getAdjustRatio() { + public String getAdjustRatio() { return adjustRatio; } - public void setAdjustRatio(Integer adjustRatio) { + public void setAdjustRatio(String adjustRatio) { this.adjustRatio = adjustRatio; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustPeriod.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustPeriod.java new file mode 100644 index 000000000..dcdba0369 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustPeriod.java @@ -0,0 +1,37 @@ +package com.iformall.enums; + + +/** + * @author gongbiao + */ + +public enum EnumRentContractAdjustPeriod { + + ADJUST_PERIOD_DAY(1, "按日计租"), + ADJUST_PERIOD_MONTH(2, "按月计租"),; + + public static EnumRentContractAdjustPeriod getEnum(Integer code) { + for (EnumRentContractAdjustPeriod value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumRentContractAdjustPeriod(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index cae2b4440..c4c197d0e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1,6 +1,7 @@ package com.iformall.service.impl; import cn.afterturn.easypoi.word.WordExportUtil; +import com.alibaba.fastjson.JSONArray; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -282,6 +283,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { int needpay = wxRentContract.getDeposit(); wxBillDeposit.setNeedPay(needpay); wxBillDeposit.setOwe(needpay); + //找到计租方式 + int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; Date date = new Date(); Calendar instance = Calendar.getInstance(); @@ -298,7 +301,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //账单结束时间 instance.clear(); instance.setTime(wxBillDeposit.getReceiveDate()); - instance.add(Calendar.MONTH, wxRentContract.getLease()); + instance.add(dayType, wxRentContract.getLease()); wxBillDeposit.setEndtime(instance.getTime()); //截止收租日在当前时间之前 @@ -342,27 +345,86 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxRentContract = list.get(0); int receivePeriod = wxRentContract.getReceivePeriod().intValue(); Integer lease = wxRentContract.getLease(); - int extralease = lease % receivePeriod; - int extracount = extralease > 0 ? 1 : 0; - int paycount = lease / receivePeriod + extracount; - int index = paycount - 1; - final IdWorker idWorker = IdWorker.get(); - for (int i = 0; i < paycount; i++) { - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(idWorker.nextId()); - wxBillRent.setRentContractId(wxRentContract.getId()); - wxBillRent.setReceivePay(0); - wxBillRent.setPay(0); - int needpay = wxRentContract.getPrice() * receivePeriod; - - Date date = new Date(); - Calendar instance = Calendar.getInstance(); - instance.setTime(wxRentContract.getRentalStartDate()); - instance.add(Calendar.MONTH, receivePeriod * i); - instance.add(Calendar.DAY_OF_MONTH, -1); - Date time = instance.getTime(); - wxBillRent.setReceiveDate(time); + Date rentalStartDate = wxRentContract.getRentalStartDate(); + Integer price = wxRentContract.getPrice(); + //按月计租 + if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode())) { + buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price); + } else { + //按日计租 + buildRent(lease, receivePeriod, price, rentalStartDate, Calendar.DAY_OF_MONTH, wxRentContract, userId, wxMerchant); + } + } + } + + public void buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Integer price) { + String adjustRatio = wxRentContract.getAdjustRatio(); + List integers = JSONArray.parseArray(adjustRatio, Integer.class); + integers.add(0, 0); + int size = integers.size(); + int[] priceArr = new int[size]; + priceArr[0] = price; + double priceD = price; + for (int i = 1; i < size; i++) { + priceD = priceD + priceD * integers.get(i) / 10000.0; + priceArr[i] = new BigDecimal(priceD).setScale(0, RoundingMode.HALF_EVEN).intValue(); + } + int month = 12; + int divide = lease / month; + int mod = lease % month; + int[] leaseArr = new int[size]; + for (int i = 0; i < divide; i++) { + leaseArr[i] = month; + } + if (mod > 0) { + leaseArr[divide] = mod; + } + + for (int i = 0; i < size; i++) { + Calendar instance = Calendar.getInstance(); + instance.setTime(rentalStartDate); + //开始时间 + instance.add(Calendar.MONTH, month * i); + buildRent(leaseArr[i], receivePeriod, priceArr[i], instance.getTime(), Calendar.MONTH, wxRentContract, userId, wxMerchant); + } + } + + public void buildRent(int lease, int receivePeriod, int price, Date startdate, int dayType, WxRentContract wxRentContract, long userId, WxMerchant wxMerchant) { + + int extralease = lease % receivePeriod; + int extracount = extralease > 0 ? 1 : 0; + int paycount = lease / receivePeriod + extracount; + int index = paycount - 1; + final IdWorker idWorker = IdWorker.get(); + for (int i = 0; i < paycount; i++) { + WxBillRent wxBillRent = new WxBillRent(); + wxBillRent.setId(idWorker.nextId()); + wxBillRent.setRentContractId(wxRentContract.getId()); + wxBillRent.setReceivePay(0); + wxBillRent.setPay(0); + int needpay = price * receivePeriod; + Date date = new Date(); + Calendar instance = Calendar.getInstance(); + instance.setTime(startdate); + instance.add(dayType, receivePeriod * i); + instance.add(Calendar.DAY_OF_MONTH, -1); + Date time = instance.getTime(); + wxBillRent.setReceiveDate(time); + + //账单开始时间 + instance.clear(); + instance.setTime(wxBillRent.getReceiveDate()); + instance.add(Calendar.DAY_OF_MONTH, 1); + wxBillRent.setStarttime(instance.getTime()); + //账单结束时间 + instance.clear(); + instance.setTime(wxBillRent.getStarttime()); + instance.add(dayType, receivePeriod); + instance.add(Calendar.DAY_OF_MONTH, -1); + wxBillRent.setEndtime(instance.getTime()); + + if (extracount > 0 && i == index) { //账单开始时间 instance.clear(); instance.setTime(wxBillRent.getReceiveDate()); @@ -371,64 +433,50 @@ public class WxRentContractServiceImpl implements WxRentContractService { //账单结束时间 instance.clear(); instance.setTime(wxBillRent.getStarttime()); - instance.add(Calendar.MONTH, receivePeriod); + instance.add(dayType, extralease); instance.add(Calendar.DAY_OF_MONTH, -1); wxBillRent.setEndtime(instance.getTime()); + needpay = price * extralease; + } + wxBillRent.setNeedPay(needpay); + wxBillRent.setOwe(needpay); - if (extracount > 0 && i == index) { - //账单开始时间 - instance.clear(); - instance.setTime(wxBillRent.getReceiveDate()); - instance.add(Calendar.DAY_OF_MONTH, 1); - wxBillRent.setStarttime(instance.getTime()); - //账单结束时间 - instance.clear(); - instance.setTime(wxBillRent.getStarttime()); - instance.add(Calendar.MONTH, extralease); - instance.add(Calendar.DAY_OF_MONTH, -1); - wxBillRent.setEndtime(instance.getTime()); - needpay = wxRentContract.getPrice() * extralease; - } - wxBillRent.setNeedPay(needpay); - wxBillRent.setOwe(needpay); - - //截止收租日在当前时间之前 - if (wxBillRent.getReceiveDate().before(date)) { - long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); - wxBillRent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); - wxBillRent.setExpiredDay(day); - } else {//截止收租日在当前时间之后 - Calendar now = Calendar.getInstance(); - now.add(Calendar.MONTH, receivePeriod); - Date currenttime = now.getTime(); - //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 - if (currenttime.before(wxBillRent.getReceiveDate())) { - wxBillRent.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); - wxBillRent.setExpiredDay(0L); - } else { - wxBillRent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); - wxBillRent.setExpiredDay(0L); - } - } - - wxBillRent.setTenantId(wxMerchant.getTenantId()); - wxBillRent.setIsDel(0); - wxBillRent.setMerchantId(wxMerchant.getId()); - wxBillRent.setUserId(userId); - wxBillRent.setShopId(wxRentContract.getShopId()); - wxBillRent.setCreatetime(date); - wxBillRent.setUpdatetime(date); - wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - - try { - wxBillRentMapper.insertSelective(wxBillRent); - } catch (Exception e) { - logger.error("添加租赁账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + //截止收租日在当前时间之前 + if (wxBillRent.getReceiveDate().before(date)) { + long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); + wxBillRent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); + wxBillRent.setExpiredDay(day); + } else {//截止收租日在当前时间之后 + Calendar now = Calendar.getInstance(); + now.add(Calendar.MONTH, receivePeriod); + Date currenttime = now.getTime(); + //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 + if (currenttime.before(wxBillRent.getReceiveDate())) { + wxBillRent.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); + wxBillRent.setExpiredDay(0L); + } else { + wxBillRent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); + wxBillRent.setExpiredDay(0L); } } + wxBillRent.setTenantId(wxMerchant.getTenantId()); + wxBillRent.setIsDel(0); + wxBillRent.setMerchantId(wxMerchant.getId()); + wxBillRent.setUserId(userId); + wxBillRent.setShopId(wxRentContract.getShopId()); + wxBillRent.setCreatetime(date); + wxBillRent.setUpdatetime(date); + wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); + + try { + wxBillRentMapper.insertSelective(wxBillRent); + } catch (Exception e) { + logger.error("添加租赁账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } } + } @@ -715,7 +763,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Override public ResultData updateRentContractStatus(Long id, Long userId) { - if(id == null) { + if (id == null) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); } //更新合同状态为签约 @@ -826,8 +874,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } result.put("brand", brand); - double adjustRatio = wxRentContract.getAdjustRatio() != null ? wxRentContract.getAdjustRatio() / 100.0 : 0; - result.put("adjustRatio", adjustRatio); + // TODO + //double adjustRatio = wxRentContract.getAdjustRatio() != null ? wxRentContract.getAdjustRatio() / 100.0 : 0; + result.put("adjustRatio", 0); double priceRent = new BigDecimal(wxRentContract.getPrice()) .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); result.put("priceRent", priceRent); @@ -853,14 +902,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { int count = paycount - 1; BigDecimal rentPrice = new BigDecimal(priceRent); if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) { - areaWay(wxRentContract, result, lease, adjustRatio, extralease, extracount, paycount, index, count, rentPrice); + areaWay(wxRentContract, result, lease, 0, extralease, extracount, paycount, index, count, rentPrice); } else { //保底 double revenue = new BigDecimal(wxRentContract.getRevenue()) .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); result.put("revenue", revenue); result.put("revenueUpper", digitUppercase(revenue)); - ratioWay(wxRentContract, result, lease, adjustRatio, extralease, extracount, paycount, index, count, rentPrice); + ratioWay(wxRentContract, result, lease, 0, extralease, extracount, paycount, index, count, rentPrice); } //物业合同信息 WxPropertyContract propertyContract = new WxPropertyContract(); @@ -1207,4 +1256,5 @@ public class WxRentContractServiceImpl implements WxRentContractService { public void updateApplyStatus(WxRentContract wxRentContract) { wxRentContractMapper.updateApplyStatus(wxRentContract); } + } From 167fe3af9204bb436c2ab8c584882b72058c8aba Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 14 Jan 2019 11:46:01 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[=E7=A7=9F=E8=B5=81=E5=90=88=E5=90=8C][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/domain/po/WxRentContract.java | 30 +++++++++++++++++++ .../resources/mapper/WxRentContractMapper.xml | 13 +++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 1d5529d2f..eafeeb6c3 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -184,6 +184,12 @@ public class WxRentContract implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "审核状态", name = "applyStatus") private Integer applyStatus; + @io.swagger.annotations.ApiModelProperty(value = "开户行", name = "bankName") + private String bankName; + + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Integer getApplyStatus() { return applyStatus; } @@ -456,6 +462,30 @@ public class WxRentContract implements Serializable { this.endDate = endDate; } + public String getBrandName() { + return brandName; + } + + public void setBrandName(String brandName) { + this.brandName = brandName; + } + + public String getBankName() { + return bankName; + } + + public void setBankName(String bankName) { + this.bankName = bankName; + } + + public Integer getRentShopType() { + return rentShopType; + } + + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } + 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; diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index f2d25678d..db00ef2ea 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -30,13 +30,15 @@ - + - + + + @@ -44,7 +46,7 @@ `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`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, - `start_date`,`end_date`,`apply_status` + `start_date`,`end_date`,`apply_status`,`bank_name`,'rent_shop_type' @@ -100,7 +102,9 @@ 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.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, - rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus + rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name + bankName, + rc.rent_shop_type rentShopType 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 @@ -113,6 +117,7 @@ and rc.`status` = #{status} and rc.`shop_id` = #{shopId} and rc.`type` = #{type} + and rc.`rent_shop_type` = #{rentShopType} order by rc.id desc From 21aaa23dae25808a929630e4d52eb72fb55e8cef Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 14 Jan 2019 11:53:14 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[=E5=95=86=E9=93=BA][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/domain/po/WxShop.java | 33 +++++++++++++++++++ .../main/resources/mapper/WxShopMapper.xml | 24 ++++++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java b/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java index 6de701c94..83dfa4812 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java @@ -104,6 +104,15 @@ public class WxShop implements Serializable { @io.swagger.annotations.ApiModelProperty(value="管理人电话",name="managerPhone") private String managerPhone; + @io.swagger.annotations.ApiModelProperty(value = "类型", name = "type") + private Integer type; + + @io.swagger.annotations.ApiModelProperty(value = "点位类型", name = "pointType") + private Integer pointType; + + @io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments") + private String comments; + public String getTenantId() { return tenantId; } @@ -243,6 +252,30 @@ public class WxShop implements Serializable { this.managerPhone = managerPhone; } + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getPointType() { + return pointType; + } + + public void setPointType(Integer pointType) { + this.pointType = pointType; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/resources/mapper/WxShopMapper.xml b/mallinkService/src/main/resources/mapper/WxShopMapper.xml index 09c389ca2..62cd24b25 100644 --- a/mallinkService/src/main/resources/mapper/WxShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxShopMapper.xml @@ -21,12 +21,16 @@ + + + + `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`, `floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`, - `update_date`,`img_url`,`manager`,`manager_phone` + `update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments` @@ -117,6 +121,15 @@ and `manager_phone` = #{managerPhone} + + + and `type` = #{type} + + + + and `point_type` = #{pointType} + + and id in @@ -139,6 +152,7 @@ s.img_url imgUrl,s.operation_area operationArea, s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId, m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone + s.type,s.point_type pointType from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 left join wx_merchant m on ms.merchant_id=m.id left join wx_mall_building b on s.building=b.id @@ -230,7 +244,13 @@ and s.`manager_phone` = #{managerPhone} - + + and s.`type` = #{type} + + + + and s.`point_type` = #{pointType} + and s.id in From 81e572932f5606aa7c284a38fc430cabac203cbb Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 14 Jan 2019 11:58:24 +0800 Subject: [PATCH 4/5] =?UTF-8?q?[=E5=95=86=E6=88=B7][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/iformall/domain/po/WxMerchant.java | 12 ++++++++++++ .../src/main/resources/mapper/WxMerchantMapper.xml | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java index 98c4557fb..11e5c8725 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -144,6 +144,10 @@ public class WxMerchant implements Serializable { @io.swagger.annotations.ApiModelProperty(value="VIP折扣率3",name="vipDiscountRate3") private Integer vipDiscountRate3; + @io.swagger.annotations.ApiModelProperty(value = "类型", name = "type") + private Integer type; + + public List> getShoplist() { return shoplist; } @@ -388,6 +392,14 @@ public class WxMerchant implements Serializable { this.accountParameter = accountParameter; } + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml index ea13f8152..f74a3af44 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml @@ -19,11 +19,13 @@ + + `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, - `business_id`,`shop_type`,`brand`,`vip_discount_rate1`,`vip_discount_rate2`,`vip_discount_rate3` + `business_id`,`shop_type`,`brand`,`vip_discount_rate1`,`vip_discount_rate2`,`vip_discount_rate3`,`type` @@ -74,6 +76,9 @@ and `link_person` = #{linkPerson} + + and `type` = #{type} + and id in From 371fc0654392c59dff04dd1e5a4fe08da9fdf832 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 14 Jan 2019 13:20:29 +0800 Subject: [PATCH 5/5] =?UTF-8?q?[=E8=B4=A6=E5=8D=95][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/domain/po/WxBillDaily.java | 10 ++ .../com/iformall/domain/po/WxBillDeposit.java | 11 ++ .../com/iformall/domain/po/WxBillOther.java | 10 ++ .../iformall/domain/po/WxBillProperty.java | 11 ++ .../domain/po/WxBillPropertyDeposit.java | 11 ++ .../com/iformall/domain/po/WxBillRent.java | 11 ++ .../service/WxRentContractService.java | 5 + .../service/impl/WxMerchantServiceImpl.java | 169 +----------------- .../impl/WxRentContractServiceImpl.java | 8 +- .../resources/mapper/WxBillDailyMapper.xml | 10 +- .../resources/mapper/WxBillDepositMapper.xml | 15 +- .../resources/mapper/WxBillOtherMapper.xml | 10 +- .../mapper/WxBillPropertyDepositMapper.xml | 16 +- .../resources/mapper/WxBillPropertyMapper.xml | 17 +- .../resources/mapper/WxBillRentMapper.xml | 11 +- .../main/resources/mapper/WxShopMapper.xml | 7 + 16 files changed, 145 insertions(+), 187 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java index b61a6fa32..f9274d31f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java @@ -104,6 +104,10 @@ public class WxBillDaily implements Serializable { /*更新时间**/ @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") private Date updatetime; + + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Integer getReceivePay() { return receivePay; } @@ -189,7 +193,13 @@ public class WxBillDaily implements Serializable { updatetime = _updatetime; } + public Integer getRentShopType() { + return rentShopType; + } + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } public static enum Field { diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java index 901e8a2e8..3f7186aff 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java @@ -98,6 +98,9 @@ public class WxBillDeposit implements Serializable { @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") private Date endtime; + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Date getStarttime() { return starttime; } @@ -219,6 +222,14 @@ public class WxBillDeposit implements Serializable { this.merchantName = merchantName; } + public Integer getRentShopType() { + return rentShopType; + } + + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java index 0644dd235..4b28c8f1a 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java @@ -115,6 +115,10 @@ public class WxBillOther implements Serializable { /*更新时间**/ @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") private Date updatetime; + + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Integer getReceivePay() { return receivePay; } @@ -200,7 +204,13 @@ public class WxBillOther implements Serializable { updatetime = _updatetime; } + public Integer getRentShopType() { + return rentShopType; + } + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } public static enum Field { diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java index c406038c5..78441681c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java @@ -98,6 +98,9 @@ public class WxBillProperty implements Serializable { @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") private Date endtime; + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Date getStarttime() { return starttime; } @@ -222,6 +225,14 @@ public class WxBillProperty implements Serializable { this.merchantName = merchantName; } + public Integer getRentShopType() { + return rentShopType; + } + + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java index 6e5bf1b80..87fc9ce79 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java @@ -98,6 +98,9 @@ public class WxBillPropertyDeposit implements Serializable { @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") private Date endtime; + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Date getStarttime() { return starttime; } @@ -221,6 +224,14 @@ public class WxBillPropertyDeposit implements Serializable { this.merchantName = merchantName; } + public Integer getRentShopType() { + return rentShopType; + } + + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java index a1b1d3360..74136464f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java @@ -100,6 +100,9 @@ public class WxBillRent implements Serializable { @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") private Date endtime; + @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") + private Integer rentShopType; + public Date getStarttime() { return starttime; } @@ -223,6 +226,14 @@ public class WxBillRent implements Serializable { this.updatetime = updatetime; } + public Integer getRentShopType() { + return rentShopType; + } + + public void setRentShopType(Integer rentShopType) { + this.rentShopType = rentShopType; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index df8de4235..95678d3b4 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -1,6 +1,7 @@ package com.iformall.service; import com.iformall.common.ResultData; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxRentContract; import javax.servlet.http.HttpServletRequest; @@ -66,4 +67,8 @@ public interface WxRentContractService { void updateApplyStatus(WxRentContract wxRentContract); + void buildRent(WxMerchant wxMerchant, Long userId); + + void buildDeposit(WxMerchant wxMerchant, Long userId); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 09ddb0c66..0d04d877d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -14,6 +14,7 @@ import com.iformall.mapper.*; import com.iformall.service.WxCouponService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxProfitSharingReceiverService; +import com.iformall.service.WxRentContractService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -75,6 +76,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxCouponMerchantMapper wxCouponMerchantMapper; + @Autowired + WxRentContractService wxRentContractService; + @Override public PageInfo listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { @@ -311,9 +315,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()); wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); //创建账单 - buildRent(wxMerchant, userId); + wxRentContractService.buildRent(wxMerchant, userId); //创建押金 - buildDeposit(wxMerchant, userId); + wxRentContractService.buildDeposit(wxMerchant, userId); } return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); } catch (Exception e) { @@ -507,165 +511,4 @@ public class WxMerchantServiceImpl implements WxMerchantService { } } - - @Transactional(rollbackFor = {Exception.class}) - public void buildDeposit(WxMerchant wxMerchant, Long userId) { - WxRentContract wxRentContract = new WxRentContract(); - wxRentContract.setMerchantId(wxMerchant.getId()); - List list = wxRentContractMapper.findList(wxRentContract); - if (list.size() > 0) { - wxRentContract = list.get(0); - final IdWorker idWorker = IdWorker.get(); - WxBillDeposit wxBillDeposit = new WxBillDeposit(); - wxBillDeposit.setId(idWorker.nextId()); - wxBillDeposit.setRentContractId(wxRentContract.getId()); - wxBillDeposit.setReceivePay(0); - wxBillDeposit.setPay(0); - int needpay = wxRentContract.getDeposit(); - wxBillDeposit.setNeedPay(needpay); - wxBillDeposit.setOwe(needpay); - - Date date = new Date(); - Calendar instance = Calendar.getInstance(); - instance.setTime(wxRentContract.getRentalStartDate()); - instance.add(Calendar.DAY_OF_MONTH, -1); - Date time = instance.getTime(); - wxBillDeposit.setReceiveDate(time); - - //账单开始时间 - instance.clear(); - instance.setTime(wxBillDeposit.getReceiveDate()); - instance.add(Calendar.DAY_OF_MONTH, 1); - wxBillDeposit.setStarttime(instance.getTime()); - //账单结束时间 - instance.clear(); - instance.setTime(wxBillDeposit.getReceiveDate()); - instance.add(Calendar.MONTH, wxRentContract.getLease()); - wxBillDeposit.setEndtime(instance.getTime()); - - //截止收租日在当前时间之前 - if (wxBillDeposit.getReceiveDate().before(date)) { - long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); - wxBillDeposit.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); - wxBillDeposit.setExpiredDay(day); - } else { - wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); - wxBillDeposit.setExpiredDay(0L); - } - - wxBillDeposit.setTenantId(wxMerchant.getTenantId()); - wxBillDeposit.setIsDel(0); - wxBillDeposit.setMerchantId(wxMerchant.getId()); - wxBillDeposit.setUserId(userId); - wxBillDeposit.setShopId(wxRentContract.getShopId()); - wxBillDeposit.setCreatetime(date); - wxBillDeposit.setUpdatetime(date); - try { - wxBillDepositMapper.insertSelective(wxBillDeposit); - } catch (Exception e) { - logger.error("添加押金账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - } - } - - @Transactional(rollbackFor = {Exception.class}) - public void buildRent(WxMerchant wxMerchant, Long userId) { - - WxRentContract wxRentContract = new WxRentContract(); - wxRentContract.setMerchantId(wxMerchant.getId()); - //根据商户ID找出合同 - List list = wxRentContractMapper.findList(wxRentContract); - if (list.size() > 0) { - wxRentContract = list.get(0); - int receivePeriod = wxRentContract.getReceivePeriod().intValue(); - Integer lease = wxRentContract.getLease(); - int extralease = lease % receivePeriod; - int extracount = extralease > 0 ? 1 : 0; - int paycount = lease / receivePeriod + extracount; - int index = paycount - 1; - final IdWorker idWorker = IdWorker.get(); - for (int i = 0; i < paycount; i++) { - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(idWorker.nextId()); - wxBillRent.setRentContractId(wxRentContract.getId()); - wxBillRent.setReceivePay(0); - wxBillRent.setPay(0); - - Date date = new Date(); - Calendar instance = Calendar.getInstance(); - instance.setTime(wxRentContract.getRentalStartDate()); - instance.add(Calendar.MONTH, receivePeriod * i); - instance.add(Calendar.DAY_OF_MONTH, -1); - Date time = instance.getTime(); - wxBillRent.setReceiveDate(time); - - //账单开始时间 - instance.clear(); - instance.setTime(wxBillRent.getReceiveDate()); - instance.add(Calendar.DAY_OF_MONTH, 1); - wxBillRent.setStarttime(instance.getTime()); - //账单结束时间 - instance.clear(); - instance.setTime(wxBillRent.getStarttime()); - instance.add(Calendar.MONTH, receivePeriod); - instance.add(Calendar.DAY_OF_MONTH, -1); - wxBillRent.setEndtime(instance.getTime()); - int needpay = wxRentContract.getPrice() * receivePeriod; - if (extracount > 0 && i == index) { - //账单开始时间 - instance.clear(); - instance.setTime(wxBillRent.getReceiveDate()); - instance.add(Calendar.DAY_OF_MONTH, 1); - wxBillRent.setStarttime(instance.getTime()); - //账单结束时间 - instance.clear(); - instance.setTime(wxBillRent.getStarttime()); - instance.add(Calendar.MONTH, extralease); - instance.add(Calendar.DAY_OF_MONTH, -1); - wxBillRent.setEndtime(instance.getTime()); - needpay = wxRentContract.getPrice() * extralease; - } - - wxBillRent.setNeedPay(needpay); - wxBillRent.setOwe(needpay); - - //截止收租日在当前时间之前 - if (wxBillRent.getReceiveDate().before(date)) { - long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); - wxBillRent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); - wxBillRent.setExpiredDay(day); - } else {//截止收租日在当前时间之后 - Calendar now = Calendar.getInstance(); - now.add(Calendar.MONTH, receivePeriod); - Date currenttime = now.getTime(); - //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 - if (currenttime.before(wxBillRent.getReceiveDate())) { - wxBillRent.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); - wxBillRent.setExpiredDay(0L); - } else { - wxBillRent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); - wxBillRent.setExpiredDay(0L); - } - } - - wxBillRent.setTenantId(wxRentContract.getTenantId()); - wxBillRent.setIsDel(0); - wxBillRent.setMerchantId(wxRentContract.getMerchantId()); - wxBillRent.setUserId(userId); - wxBillRent.setShopId(wxRentContract.getShopId()); - wxBillRent.setCreatetime(date); - wxBillRent.setUpdatetime(date); - try { - wxBillRentMapper.insertSelective(wxBillRent); - } catch (Exception e) { - logger.error("添加租赁账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - } - - } - } - - } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index c4c197d0e..421ae8815 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -168,7 +168,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } wxRentContractMapper.insertSelective(record); //建立账单 - if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) + /*if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) && record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) { WxBillRent wxBillRent = new WxBillRent(); wxBillRent.setMerchantId(record.getMerchantId()); @@ -182,7 +182,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //押金 buildDeposit(wxMerchant, userId); } - } + }*/ } catch (Exception e) { logger.error("保存租赁合同信息失败,e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); @@ -244,7 +244,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } wxRentContractMapper.updateByPrimaryKeySelective(record); //建立账单 - if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) + /*if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) && record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) { WxBillRent wxBillRent = new WxBillRent(); wxBillRent.setMerchantId(record.getMerchantId()); @@ -258,7 +258,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //押金 buildDeposit(wxMerchant, userId); } - } + }*/ } catch (Exception e) { logger.error("更新租赁合同信息失败,e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); diff --git a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml index 6490b6f97..0ecc8c059 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml @@ -18,11 +18,14 @@ + - `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type` + `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, + `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`, + `rent_shop_type` @@ -43,6 +46,7 @@ and `shop_id` = #{shopId} and `updatetime` = #{updatetime} and `type` = #{type} + and `rent_shop_type` = #{rentShopType} and id in @@ -62,7 +66,7 @@ select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, - br.`merchant_id` merchantId,br.shop_id shopId,br.type + br.`merchant_id` merchantId,br.shop_id shopId,br.type,br.`rent_shop_type` rentShopType from wx_bill_daily br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id @@ -73,6 +77,8 @@ and br.`status` = #{status} and br.`is_del` = #{isDel} and br.`type` = #{type} + and br.`rent_shop_type` = #{rentShopType} + order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml index f078b3681..4146b5cfa 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml @@ -19,10 +19,14 @@ + + - `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime` + `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`, + `expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime`, + `rent_shop_type` @@ -42,8 +46,10 @@ and `need_pay` = #{needPay} and `merchant_id` = #{merchantId} and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} + and `shop_id` = #{shopId} + and `updatetime` = #{updatetime} + and `rent_shop_type` = #{rentShopType} + and id in @@ -63,7 +69,7 @@ select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, - br.`merchant_id` merchantId + br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType from wx_bill_rent_deposit br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id @@ -73,6 +79,7 @@ and br.`tenant_id` = #{tenantId} and br.`status` = #{status} and br.`is_del` = #{isDel} + and br.`rent_shop_type` = #{rentShopType} order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml b/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml index d58675583..d0355b255 100644 --- a/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml @@ -19,11 +19,14 @@ + - `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments` + `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, + `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, + `rent_shop_type` @@ -44,6 +47,7 @@ and `shop_id` = #{shopId} and `updatetime` = #{updatetime} and `name` = #{name} + and `rent_shop_type` = #{rentShopType} and id in @@ -63,7 +67,7 @@ select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, - br.`merchant_id` merchantId,br.shop_id shopId,br.name,br.comments + br.`merchant_id` merchantId,br.shop_id shopId,br.name,br.comments,br.`rent_shop_type` rentShopType from wx_bill_other br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id @@ -74,6 +78,8 @@ and br.`status` = #{status} and br.`is_del` = #{isDel} and br.`name` = #{name} + and br.`rent_shop_type` = #{rentShopType} + order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml index 778a967ce..1b4dbf6bf 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml @@ -19,10 +19,14 @@ + + - `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime` + `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`, + `pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, + `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type` @@ -42,8 +46,10 @@ and `need_pay` = #{needPay} and `merchant_id` = #{merchantId} and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} + and `shop_id` = #{shopId} + and `updatetime` = #{updatetime} + and `rent_shop_type` = #{rentShopType} + and id in @@ -62,7 +68,7 @@ select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, - br.`merchant_id` merchantId + br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType from wx_bill_property_deposit br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id @@ -72,6 +78,8 @@ and br.`tenant_id` = #{tenantId} and br.`status` = #{status} and br.`is_del` = #{isDel} + and br.`rent_shop_type` = #{rentShopType} + order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index 82a780b93..b86bdc5db 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -19,10 +19,14 @@ + + - `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime` + `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, + `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, + `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type` @@ -42,8 +46,10 @@ and `need_pay` = #{needPay} and `merchant_id` = #{merchantId} and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} + and `shop_id` = #{shopId} + and `updatetime` = #{updatetime} + and `rent_shop_type` = #{rentShopType} + and id in @@ -62,7 +68,7 @@ select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, - br.`merchant_id` merchantId + br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType from wx_bill_property br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id @@ -73,7 +79,8 @@ and br.`status` = #{status} and br.`is_del` = #{isDel} and br.`receive_date` between #{starttime} and #{endtime} - + and br.`rent_shop_type` = #{rentShopType} + order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index fb656cde4..7768499c5 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -19,12 +19,15 @@ + - `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime` + `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, + `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, + `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type` @@ -46,7 +49,7 @@ and `user_id` = #{userId} and `shop_id` = #{shopId} and `updatetime` = #{updatetime} - + and `rent_shop_type` = #{rentShopType} and id in @@ -69,7 +72,7 @@ select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, - br.`merchant_id` merchantId + br.`merchant_id` merchantId,br.`rent_shop_type` rentShopType from wx_bill_rent br left join wx_merchant m on br.merchant_id=m.id left join wx_shop s on br.shop_id=s.id @@ -80,6 +83,8 @@ and br.`status` = #{status} and br.`is_del` = #{isDel} and br.`receive_date` between #{starttime} and #{endtime} + and br.`rent_shop_type` = #{rentShopType} + order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxShopMapper.xml b/mallinkService/src/main/resources/mapper/WxShopMapper.xml index 62cd24b25..35978225a 100644 --- a/mallinkService/src/main/resources/mapper/WxShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxShopMapper.xml @@ -303,6 +303,13 @@ SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status!=1 and status!=5 and status!=6 and status!=7 and merchant_id is not null ) + + and s.`type` = #{type} + + + + and s.`point_type` = #{pointType} + order by s.${sortColumns}