Просмотр исходного кода

Merge remote-tracking branch 'origin/develop' into develop

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
070e8dc85d
22 измененных файлов: 425 добавлений и 275 удалений
  1. +10
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java
  2. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java
  3. +10
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java
  4. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java
  5. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java
  6. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java
  7. +12
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java
  8. +34
    -4
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  9. +33
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxShop.java
  10. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustPeriod.java
  11. +5
    -0
      mallinkService/src/main/java/com/iformall/service/WxRentContractService.java
  12. +6
    -163
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  13. +131
    -81
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  14. +8
    -2
      mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml
  15. +11
    -4
      mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml
  16. +8
    -2
      mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml
  17. +12
    -4
      mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml
  18. +12
    -5
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml
  19. +8
    -3
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml
  20. +6
    -1
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml
  21. +9
    -4
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml
  22. +29
    -2
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 10
- 0
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
{


+ 11
- 0
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")


+ 10
- 0
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
{


+ 11
- 0
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")


+ 11
- 0
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")


+ 11
- 0
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")


+ 12
- 0
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<Map<String, Object>> 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")


+ 34
- 4
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")
@@ -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;
}
@@ -408,11 +414,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;
}

@@ -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;


+ 33
- 0
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")


+ 37
- 0
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;
}
}

+ 5
- 0
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);

}

+ 6
- 163
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<WxMerchant> 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<WxRentContract> 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<WxRentContract> 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());
}
}

}
}


}

+ 131
- 81
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;
@@ -167,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());
@@ -181,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());
@@ -243,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());
@@ -257,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());
@@ -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<Integer> 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);
}

}

+ 8
- 2
mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml Просмотреть файл

@@ -18,11 +18,14 @@
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -43,6 +46,7 @@
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
<if test=" null != type "> and `type` = #{type} </if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
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
<where>
@@ -73,6 +77,8 @@
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != type ">and br.`type` = #{type}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
</where>
order by id desc
</select>


+ 11
- 4
mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml Просмотреть файл

@@ -19,10 +19,14 @@
<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"/>
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -42,8 +46,10 @@
<if test=" null != needPay "> and `need_pay` = #{needPay} </if>
<if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
<if test=" null != userId "> and `user_id` = #{userId} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -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
<where>
@@ -73,6 +79,7 @@
<if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if>
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
</where>
order by id desc


+ 8
- 2
mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml Просмотреть файл

@@ -19,11 +19,14 @@
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="comments" jdbcType="VARCHAR" property="comments" />
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -44,6 +47,7 @@
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
<if test=" null != name "> and `name` = #{name} </if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
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
<where>
@@ -74,6 +78,8 @@
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != name ">and br.`name` = #{name}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
</where>
order by id desc
</select>


+ 12
- 4
mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml Просмотреть файл

@@ -19,10 +19,14 @@
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -42,8 +46,10 @@
<if test=" null != needPay "> and `need_pay` = #{needPay} </if>
<if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
<if test=" null != userId "> and `user_id` = #{userId} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -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
<where>
@@ -72,6 +78,8 @@
<if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if>
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
</where>
order by id desc


+ 12
- 5
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml Просмотреть файл

@@ -19,10 +19,14 @@
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -42,8 +46,10 @@
<if test=" null != needPay "> and `need_pay` = #{needPay} </if>
<if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
<if test=" null != userId "> and `user_id` = #{userId} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -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
<where>
@@ -73,7 +79,8 @@
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
</where>
order by id desc
</select>


+ 8
- 3
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Просмотреть файл

@@ -19,12 +19,15 @@
<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"/>
</resultMap>
<sql id="allColumns">
`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`
</sql>
<sql id="dynamicWhereConditions">
@@ -46,7 +49,7 @@
<if test=" null != userId ">and `user_id` = #{userId}</if>
<if test=" null != shopId ">and `shop_id` = #{shopId}</if>
<if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
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
<where>
@@ -80,6 +83,8 @@
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
</where>
order by id desc
</select>


+ 6
- 1
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -19,11 +19,13 @@
<result column="vip_discount_rate1" jdbcType="SMALLINT" property="vipDiscountRate1"/>
<result column="vip_discount_rate2" jdbcType="SMALLINT" property="vipDiscountRate2"/>
<result column="vip_discount_rate3" jdbcType="SMALLINT" property="vipDiscountRate3"/>
<result column="type" jdbcType="SMALLINT" property="type"/>

</resultMap>

<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -74,6 +76,9 @@
<if test=" null != linkPerson ">
and `link_person` = #{linkPerson}
</if>
<if test=" null != type ">
and `type` = #{type}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


+ 9
- 4
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Просмотреть файл

@@ -30,13 +30,15 @@
<result column="lease" jdbcType="INTEGER" property="lease"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="revenue" jdbcType="INTEGER" property="revenue"/>
<result column="adjust_ratio" jdbcType="INTEGER" property="adjustRatio"/>
<result column="adjust_ratio" jdbcType="VARCHAR" property="adjustRatio"/>
<result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/>
<result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/>
<result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
<result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
<result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>

<result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
</resultMap>
<sql id="allColumns">
@@ -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'
</sql>
<sql id="dynamicWhereConditions">
@@ -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 @@
<if test=" null != status ">and rc.`status` = #{status}</if>
<if test=" null != shopId ">and rc.`shop_id` = #{shopId}</if>
<if test=" null != type ">and rc.`type` = #{type}</if>
<if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if>
</where>
order by rc.id desc


+ 29
- 2
mallinkService/src/main/resources/mapper/WxShopMapper.xml Просмотреть файл

@@ -21,12 +21,16 @@
<result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
<result column="manager" jdbcType="VARCHAR" property="manager"/>
<result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="point_type" jdbcType="INTEGER" property="pointType"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>

</resultMap>

<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -117,6 +121,15 @@
<if test=" null != managerPhone ">
and `manager_phone` = #{managerPhone}
</if>
<if test=" null != type ">
and `type` = #{type}
</if>
<if test=" null != pointType ">
and `point_type` = #{pointType}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -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 @@
<if test=" null != managerPhone ">
and s.`manager_phone` = #{managerPhone}
</if>
<if test=" null != type ">
and s.`type` = #{type}
</if>
<if test=" null != pointType ">
and s.`point_type` = #{pointType}
</if>
<if test=" null != ids ">
and s.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -283,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
)
</if>
<if test=" null != type ">
and s.`type` = #{type}
</if>
<if test=" null != pointType ">
and s.`point_type` = #{pointType}
</if>
<if test=" null != sortColumns">order by s.${sortColumns}</if>
</select>


Загрузка…
Отмена
Сохранить