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 576c1fc59..6dec37758 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java @@ -4,7 +4,6 @@ import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; import java.io.Serializable; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -60,13 +59,13 @@ public class WxBillRent implements Serializable { private Date createtime; /*逾期天数**/ @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Integer expiredDay; + private Long expiredDay; /*租户**/ @io.swagger.annotations.ApiModelProperty(value="租户",name="tenantId") private String tenantId; /*欠缴**/ @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") - private BigDecimal owe; + private Integer owe; /*账单状态1未到期2待缴3逾期未缴4部分逾期5已结清**/ @io.swagger.annotations.ApiModelProperty(value="账单状态1未到期2待缴3欠缴4已结清",name="status") private Integer status; @@ -126,10 +125,10 @@ public class WxBillRent implements Serializable { public void setCreatetime(Date _createtime) { createtime = _createtime; } - public Integer getExpiredDay() { + public Long getExpiredDay() { return expiredDay; } - public void setExpiredDay(Integer _expiredDay) { + public void setExpiredDay(Long _expiredDay) { expiredDay = _expiredDay; } public String getTenantId() { @@ -138,10 +137,10 @@ public class WxBillRent implements Serializable { public void setTenantId(String _tenantId) { tenantId = _tenantId; } - public BigDecimal getOwe() { + public Integer getOwe() { return owe; } - public void setOwe(BigDecimal _owe) { + public void setOwe(Integer _owe) { owe = _owe; } public Integer getStatus() { 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 2ab8c12bd..415186e93 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -13,346 +13,366 @@ import java.util.List; */ @Table(name = "wx_rent_contract") public class WxRentContract implements Serializable { - private static final long serialVersionUID = 1L; - - @Id + private static final long serialVersionUID = 1L; + + @Id protected Long id; - + @Transient protected List ids; @Transient protected String sortColumns; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public String getSortColumns() { - return sortColumns; - } - - public List getIds() { - return ids; - } - public void setIds(List ids) { - this.ids = ids; - } - - @Transient - private String shopNumber; - - public String getShopNumber() { - return shopNumber; - } - - public void setShopNumber(String shopNumber) { - this.shopNumber = shopNumber; - } - - /*商户**/ - @io.swagger.annotations.ApiModelProperty(value="商户",name="merchantId") - private Long merchantId; - /*月租金/分成(分)**/ - @io.swagger.annotations.ApiModelProperty(value="月租金/分成(分)",name="price") - private Integer price; - /*计租开始时间**/ - @io.swagger.annotations.ApiModelProperty(value="计租开始时间",name="rentalStartDate") - private Date rentalStartDate; - /*计租结束时间**/ - @io.swagger.annotations.ApiModelProperty(value="计租结束时间",name="rentalEndDate") - private Date rentalEndDate; - /*签定合同时间**/ - @io.swagger.annotations.ApiModelProperty(value="签定合同时间",name="signDate") - private Date signDate; - /*付款周期**/ - @io.swagger.annotations.ApiModelProperty(value="付款周期",name="receivePeriod") - private Integer receivePeriod; - /*租户ID**/ - @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") - private String tenantId; - /*合同文件路径**/ - @io.swagger.annotations.ApiModelProperty(value="合同文件路径",name="filepath") - private String filepath; - /*合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期**/ - @io.swagger.annotations.ApiModelProperty(value="合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期",name="status") - private Integer status; - /*合同编号**/ - @io.swagger.annotations.ApiModelProperty(value="合同编号",name="contractNumber") - private String contractNumber; - /*押金**/ - @io.swagger.annotations.ApiModelProperty(value="押金",name="deposit") - private String deposit; - - /*交租日 计租开始时间减去交租日的天数为基数 提前多少日交租**/ - @io.swagger.annotations.ApiModelProperty(value="交租日 计租开始时间减去交租日的天数为基数 提前多少日交租",name="payDate") - private Integer payDate; - /*是否删除1是0否**/ - @io.swagger.annotations.ApiModelProperty(value="是否删除1是0否",name="isDel") - private Integer isDel; - /*商户名称**/ - @io.swagger.annotations.ApiModelProperty(value="商户名称",name="merchantName") - private String merchantName; - /*经营品牌**/ - @io.swagger.annotations.ApiModelProperty(value="经营品牌",name="brand") - private String brand; - /*经常业态ID**/ - @io.swagger.annotations.ApiModelProperty(value="经常业态ID",name="businessId") - private Long businessId; - /*店铺类型**/ - @io.swagger.annotations.ApiModelProperty(value="店铺类型",name="shopType") - private Integer shopType; - /*商铺ID**/ - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - /*更新时间**/ - @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") - private Date updatetime; - - @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") - private Date createtime; - - @io.swagger.annotations.ApiModelProperty(value="计租面积",name="rentArea") - private String rent_area; - - @io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson") - private String linkPerson; - - @io.swagger.annotations.ApiModelProperty(value="联系电话",name="linkPhone") - private String linkPhone; - - @io.swagger.annotations.ApiModelProperty(value="联系电话",name="payAccount") - private String payAccount; - - - public Long getMerchantId() { - return merchantId; - } - public void setMerchantId(Long _merchantId) { - merchantId = _merchantId; - } - public Integer getPrice() { - return price; - } - public void setPrice(Integer _price) { - price = _price; - } - public Date getRentalStartDate() { - return rentalStartDate; - } - public void setRentalStartDate(Date _rentalStartDate) { - rentalStartDate = _rentalStartDate; - } - public Date getRentalEndDate() { - return rentalEndDate; - } - public void setRentalEndDate(Date _rentalEndDate) { - rentalEndDate = _rentalEndDate; - } - public Date getSignDate() { - return signDate; - } - public void setSignDate(Date _signDate) { - signDate = _signDate; - } - public Integer getReceivePeriod() { - return receivePeriod; - } - public void setReceivePeriod(Integer _receivePeriod) { - receivePeriod = _receivePeriod; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String _tenantId) { - tenantId = _tenantId; - } - public String getFilepath() { - return filepath; - } - public void setFilepath(String _filepath) { - filepath = _filepath; - } - public Integer getStatus() { - return status; - } - public void setStatus(Integer _status) { - status = _status; - } - public String getContractNumber() { - return contractNumber; - } - public void setContractNumber(String _contractNumber) { - contractNumber = _contractNumber; - } - public String getDeposit() { - return deposit; - } - public void setDeposit(String _deposit) { - deposit = _deposit; - } - public Integer getPayDate() { - return payDate; - } - public void setPayDate(Integer _payDate) { - payDate = _payDate; - } - public Integer getIsDel() { - return isDel; - } - public void setIsDel(Integer _isDel) { - isDel = _isDel; - } - public String getMerchantName() { - return merchantName; - } - public void setMerchantName(String _merchantName) { - merchantName = _merchantName; - } - public String getBrand() { - return brand; - } - public void setBrand(String _brand) { - brand = _brand; - } - public Long getBusinessId() { - return businessId; - } - public void setBusinessId(Long _businessId) { - businessId = _businessId; - } - public Integer getShopType() { - return shopType; - } - public void setShopType(Integer _shopType) { - shopType = _shopType; - } - public Long getShopId() { - return shopId; - } - public void setShopId(Long _shopId) { - shopId = _shopId; - } - public Date getUpdatetime() { - return updatetime; - } - public void setUpdatetime(Date _updatetime) { - updatetime = _updatetime; - } - - public Date getCreatetime() { - return createtime; - } - - public void setCreatetime(Date createtime) { - this.createtime = createtime; - } - - public String getRent_area() { - return rent_area; - } - - public void setRent_area(String rent_area) { - this.rent_area = rent_area; - } - - public String getLinkPerson() { - return linkPerson; - } - - public void setLinkPerson(String linkPerson) { - this.linkPerson = linkPerson; - } - - public String getLinkPhone() { - return linkPhone; - } - - public void setLinkPhone(String linkPhone) { - this.linkPhone = linkPhone; - } - - public String getPayAccount() { - return payAccount; - } - - public void setPayAccount(String payAccount) { - this.payAccount = payAccount; - } - - 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; - Field(String value){ - this.value = value; - } - public String getValue() { - return value; - } - public void setCol(String value) { - this.value = value; - } - @Override - public String toString() { - return this.getValue(); - } - } - - public void setSortColumns(Field... fields) - { - if (fields == null || fields.length == 0) { - return; - } - for (int k = 0; k < fields.length; k++) { - if (fields[k] == null) { - return; - } - } - StringBuilder sb = new StringBuilder(fields[0].toString()); - for (int k = 1; k < fields.length; k++) { - sb.append(","); - sb.append(fields[k].toString()); - } - this.sortColumns=sb.toString(); - } - - public void setSortColumns(String sortColumns) - { - if (sortColumns == null || "".equals(sortColumns.trim())) { - return; - } - if (sortColumns.contains(",")) { - String[] cols = sortColumns.split(","); - List fList = new ArrayList(); - for (int k = 0; k < cols.length; k++) { - fList.add(Field.valueOf(cols[k])); - } - this.setSortColumns(fList.toArray(new Field[fList.size()])); - } else { - this.setSortColumns(Field.valueOf(sortColumns)); - } - } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + @Transient + private String shopNumber; + + public String getShopNumber() { + return shopNumber; + } + + public void setShopNumber(String shopNumber) { + this.shopNumber = shopNumber; + } + + /*商户**/ + @io.swagger.annotations.ApiModelProperty(value = "商户", name = "merchantId") + private Long merchantId; + /*月租金/分成(分)**/ + @io.swagger.annotations.ApiModelProperty(value = "月租金/分成(分)", name = "price") + private Integer price; + /*计租开始时间**/ + @io.swagger.annotations.ApiModelProperty(value = "计租开始时间", name = "rentalStartDate") + private Date rentalStartDate; + /*计租结束时间**/ + @io.swagger.annotations.ApiModelProperty(value = "计租结束时间", name = "rentalEndDate") + private Date rentalEndDate; + /*签定合同时间**/ + @io.swagger.annotations.ApiModelProperty(value = "签定合同时间", name = "signDate") + private Date signDate; + /*付款周期**/ + @io.swagger.annotations.ApiModelProperty(value = "付款周期", name = "receivePeriod") + private Integer receivePeriod; + /*租户ID**/ + @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") + private String tenantId; + /*合同文件路径**/ + @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath") + private String filepath; + /*合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期**/ + @io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期", name = "status") + private Integer status; + /*合同编号**/ + @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNumber") + private String contractNumber; + /*押金**/ + @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") + private String deposit; + + /*交租日 计租开始时间减去交租日的天数为基数 提前多少日交租**/ + @io.swagger.annotations.ApiModelProperty(value = "交租日 计租开始时间减去交租日的天数为基数 提前多少日交租", name = "payDate") + private Integer payDate; + /*是否删除1是0否**/ + @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") + private Integer isDel; + /*商户名称**/ + @io.swagger.annotations.ApiModelProperty(value = "商户名称", name = "merchantName") + private String merchantName; + /*经营品牌**/ + @io.swagger.annotations.ApiModelProperty(value = "经营品牌", name = "brand") + private String brand; + /*经常业态ID**/ + @io.swagger.annotations.ApiModelProperty(value = "经常业态ID", name = "businessId") + private Long businessId; + /*店铺类型**/ + @io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopType") + private Integer shopType; + /*商铺ID**/ + @io.swagger.annotations.ApiModelProperty(value = "商铺ID", name = "shopId") + private Long shopId; + /*更新时间**/ + @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") + private Date updatetime; + + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime") + private Date createtime; + + @io.swagger.annotations.ApiModelProperty(value = "计租面积", name = "rentArea") + private String rentArea; + + @io.swagger.annotations.ApiModelProperty(value = "联系人", name = "linkPerson") + private String linkPerson; + + @io.swagger.annotations.ApiModelProperty(value = "联系电话", name = "linkPhone") + private String linkPhone; + + @io.swagger.annotations.ApiModelProperty(value = "联系电话", name = "payAccount") + private String payAccount; + + + public Long getMerchantId() { + return merchantId; + } + + public void setMerchantId(Long _merchantId) { + merchantId = _merchantId; + } + + public Integer getPrice() { + return price; + } + + public void setPrice(Integer _price) { + price = _price; + } + + public Date getRentalStartDate() { + return rentalStartDate; + } + + public void setRentalStartDate(Date _rentalStartDate) { + rentalStartDate = _rentalStartDate; + } + + public Date getRentalEndDate() { + return rentalEndDate; + } + + public void setRentalEndDate(Date _rentalEndDate) { + rentalEndDate = _rentalEndDate; + } + + public Date getSignDate() { + return signDate; + } + + public void setSignDate(Date _signDate) { + signDate = _signDate; + } + + public Integer getReceivePeriod() { + return receivePeriod; + } + + public void setReceivePeriod(Integer _receivePeriod) { + receivePeriod = _receivePeriod; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String _tenantId) { + tenantId = _tenantId; + } + + public String getFilepath() { + return filepath; + } + + public void setFilepath(String _filepath) { + filepath = _filepath; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer _status) { + status = _status; + } + + public String getContractNumber() { + return contractNumber; + } + + public void setContractNumber(String _contractNumber) { + contractNumber = _contractNumber; + } + + public String getDeposit() { + return deposit; + } + + public void setDeposit(String _deposit) { + deposit = _deposit; + } + + public Integer getPayDate() { + return payDate; + } + + public void setPayDate(Integer _payDate) { + payDate = _payDate; + } + + public Integer getIsDel() { + return isDel; + } + + public void setIsDel(Integer _isDel) { + isDel = _isDel; + } + + public String getMerchantName() { + return merchantName; + } + + public void setMerchantName(String _merchantName) { + merchantName = _merchantName; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String _brand) { + brand = _brand; + } + + public Long getBusinessId() { + return businessId; + } + + public void setBusinessId(Long _businessId) { + businessId = _businessId; + } + + public Integer getShopType() { + return shopType; + } + + public void setShopType(Integer _shopType) { + shopType = _shopType; + } + + public Long getShopId() { + return shopId; + } + + public void setShopId(Long _shopId) { + shopId = _shopId; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date _updatetime) { + updatetime = _updatetime; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public String getRentArea() { + return rentArea; + } + + public void setRentArea(String rentArea) { + this.rentArea = rentArea; + } + + public String getLinkPerson() { + return linkPerson; + } + + public void setLinkPerson(String linkPerson) { + this.linkPerson = linkPerson; + } + + public String getLinkPhone() { + return linkPhone; + } + + public void setLinkPhone(String linkPhone) { + this.linkPhone = linkPhone; + } + + public String getPayAccount() { + return payAccount; + } + + public void setPayAccount(String payAccount) { + this.payAccount = payAccount; + } + + 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; + + Field(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public void setCol(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(Field... fields) { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + this.sortColumns = sb.toString(); + } + + public void setSortColumns(String sortColumns) { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + List fList = new ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBillRentStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumBillRentStatus.java index 798259ccb..6caba4354 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumBillRentStatus.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumBillRentStatus.java @@ -5,8 +5,10 @@ package com.iformall.enums; */ public enum EnumBillRentStatus { - NOT_PAID(0, "已结清"), - PAID(1, "未结清"), + NOT_EXPIRED(1,"未到期"), + WAIT_PAY(2,"待缴"), + NOT_PAID(3, "欠缴"), + PAID(4, "已结清"), ; public static EnumBillRentStatus getEnum(Integer code) { 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 7002ea661..f38d6fcf3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -2,23 +2,23 @@ package com.iformall.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.domain.po.*; import com.iformall.enums.*; +import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.service.WxCouponService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxProfitSharingReceiverService; +import org.apache.shiro.SecurityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -27,8 +27,8 @@ import java.util.stream.Collectors; @Service public class WxMerchantServiceImpl implements WxMerchantService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired + + @Autowired WxMerchantMapper wxMerchantMapper; @Autowired @@ -57,6 +57,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxProfitSharingReceiverService wxProfitSharingReceiverService; + @Override public PageInfo listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { @@ -67,9 +68,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { PageHelper.startPage(pageIndex, pageSize); List merchants = wxMerchantMapper.findList(record); - for(WxMerchant merchant:merchants){ + for (WxMerchant merchant : merchants) { List collect = merchantShops.stream().filter(ms -> ms.getMerchantId().equals(merchant.getId())).collect(Collectors.toList()); - if(collect!=null && collect.size()>0){ + if (collect != null && collect.size() > 0) { merchant.setRentalStartDate(collect.get(0).getRentalStartDate()); merchant.setRentalEndDate(collect.get(0).getRentalEndDate()); } @@ -88,10 +89,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public WxMerchant getById(Long id) { WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id); - WxMerchantShop wxMerchantShop=new WxMerchantShop(); + WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setMerchantId(wxMerchant.getId()); wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List> shops = new ArrayList<>(); + List> shops = new ArrayList<>(); // WxRentContract wxRentContract = new WxRentContract(); // wxRentContract.setMerchantId(id); @@ -103,13 +104,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { // } List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); - for(WxMerchantShop merchantShop:wxMerchantShopList){ + for (WxMerchantShop merchantShop : wxMerchantShopList) { wxMerchant.setRentalStartDate(merchantShop.getRentalStartDate()); wxMerchant.setRentalEndDate(merchantShop.getRentalEndDate()); WxShop record = new WxShop(); record.setId(merchantShop.getShopId()); - List> shoplist = wxShopMapper.findListMap(record); - if(shoplist.size()>0) { + List> shoplist = wxShopMapper.findListMap(record); + if (shoplist.size() > 0) { shops.add(shoplist.get(0)); } } @@ -134,7 +135,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public void disable(Long id) { WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id); - if(wxMerchant==null){ + if (wxMerchant == null) { logger.info("未发现要停用的商户"); return; } @@ -146,7 +147,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchantShopQuery.setTenantId(wxMerchant.getTenantId()); wxMerchantShopQuery.setMerchantId(wxMerchant.getId()); List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShopQuery); - for(WxMerchantShop merchantShop:wxMerchantShopList){ + for (WxMerchantShop merchantShop : wxMerchantShopList) { merchantShop.setIsDel(EnumDelStatus.DEL.getCode()); wxMerchantShopMapper.updateByPrimaryKeySelective(merchantShop); @@ -161,7 +162,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { WxMerchantBUser bUser = new WxMerchantBUser(); bUser.setMerchantId(wxMerchant.getId()); List wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); - for(WxMerchantBUser wxMerchantBUser:wxMerchantBUserMapperList){ + for (WxMerchantBUser wxMerchantBUser : wxMerchantBUserMapperList) { wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); } @@ -170,7 +171,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { WxCoupon wxCoupon = new WxCoupon(); wxCoupon.setMerchantId(wxMerchant.getId()); List wxCouponList = wxCouponMapper.findList(wxCoupon); - for(WxCoupon c:wxCouponList){ + for (WxCoupon c : wxCouponList) { c.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); wxCouponService.updateCoupon(c); } @@ -201,7 +202,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { //保存商户商铺的关联 List shopidlist = wxMerchant.getShopids(); - for(Long shopid:shopidlist){ + for (Long shopid : shopidlist) { WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setId(idWorker.nextId()); wxMerchantShop.setMerchantId(merchantid); @@ -226,7 +227,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { List bUsers = wxMerchant.getbUsers(); //保存商户关联用户 - for(WxMerchantBUser user:bUsers){ + for (WxMerchantBUser user : bUsers) { long id = idWorker.nextId(); user.setId(id); user.setBUserId(id); @@ -240,7 +241,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchantBUserMapper.insertSelective(user); } //添加商户的分账账户(不是必选) - if(wxMerchant.getAccountId() != null && wxMerchant.getAccountName() != null) { + if (wxMerchant.getAccountId() != null && wxMerchant.getAccountName() != null) { WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); receiver.setReceiverAccount(wxMerchant.getAccountId()); receiver.setReceiverComments(wxMerchant.getName()); @@ -264,7 +265,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchantShopQuery.setTenantId(wxMerchant.getTenantId()); wxMerchantShopQuery.setMerchantId(wxMerchant.getId()); List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShopQuery); - for(WxMerchantShop merchantShop:wxMerchantShopList){ + for (WxMerchantShop merchantShop : wxMerchantShopList) { merchantShop.setIsDel(EnumDelStatus.DEL.getCode()); wxMerchantShopMapper.updateByPrimaryKeySelective(merchantShop); @@ -278,7 +279,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { //保存商户商铺的关联 List shopidlist = wxMerchant.getShopids(); - for(Long shopid:shopidlist){ + for (Long shopid : shopidlist) { WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setId(idWorker.nextId()); wxMerchantShop.setMerchantId(wxMerchant.getId()); @@ -305,15 +306,15 @@ public class WxMerchantServiceImpl implements WxMerchantService { WxMerchantBUser bUser = new WxMerchantBUser(); bUser.setMerchantId(wxMerchant.getId()); List wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); - for(WxMerchantBUser wxMerchantBUser:wxMerchantBUserMapperList){ + for (WxMerchantBUser wxMerchantBUser : wxMerchantBUserMapperList) { wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); } //保存商户关联用户 - for(WxMerchantBUser user:bUsers){ - if(user.getId()==null){//没有id的新增 + for (WxMerchantBUser user : bUsers) { + if (user.getId() == null) {//没有id的新增 long id = idWorker.nextId(); user.setId(id); user.setBUserId(id); @@ -325,7 +326,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { user.setUpdateDate(date); user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); wxMerchantBUserMapper.insertSelective(user); - }else{//有id的更新 + } else {//有id的更新 user.setBUserId(user.getId()); user.setMerchantId(wxMerchant.getId()); user.setTenantId(wxMerchant.getTenantId()); @@ -340,8 +341,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { //添加商户的分账账户(不是必选) - if(wxMerchant.getAccountId() != null && wxMerchant.getAccountName() != null - && !wxMerchant.getAccountId().isEmpty() && !wxMerchant.getAccountName().isEmpty()) { + if (wxMerchant.getAccountId() != null && wxMerchant.getAccountName() != null + && !wxMerchant.getAccountId().isEmpty() && !wxMerchant.getAccountName().isEmpty()) { WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); receiver.setReceiverAccount(wxMerchant.getAccountId()); receiver.setReceiverComments(wxMerchant.getName()); @@ -356,138 +357,78 @@ public class WxMerchantServiceImpl implements WxMerchantService { } -// private void buildRent(WxRentContract wxRentContract,WxShop wxshop) { -// -// Date rentalStartDate = wxRentContract.getRentalStartDate(); -// Date rentalEndDate = wxRentContract.getRentalEndDate(); -// Integer receivePeriod = wxRentContract.getReceivePeriod(); -// -// int paycount = 12 / receivePeriod.intValue(); -// final IdWorker idWorker = IdWorker.get(); -// if(paycount==1){//12 -// WxBillRent wxBillRent = new WxBillRent(); -// wxBillRent.setId(idWorker.nextId()); -// wxBillRent.setShopId(wxshop.getId()); -// wxBillRent.setPayStatus(EnumBillRentStatus.NOT_PAID.getCode()); -// wxBillRent.setPay(new BigDecimal(0)); -// wxBillRent.setTenantId(wxshop.getTenantId()); -// BigDecimal needpay = wxRentContract.getPayArea().multiply(wxRentContract.getPrice()); -// wxBillRent.setNeedPay(needpay); -// wxBillRent.setExpiredDay(0); -// wxBillRent.setOwe(new BigDecimal(0)); -// wxBillRent.setPayDate(rentalStartDate); -// wxBillRent.setPayWay(EnumBillRentPayWay.CASH.getCode()); -// wxBillRent.setPrice(wxRentContract.getPrice()); -// wxBillRent.setReceiptNum(""); -// wxBillRent.setReceiveDate(rentalStartDate); -// wxBillRent.setReceivePay(new BigDecimal(0)); -// wxBillRent.setReceivePeriod(receivePeriod); -// wxBillRent.setUserArea(new BigDecimal(wxshop.getOperationArea())); -// wxBillRent.setShopNumber(wxshop.getShopNumber()); -// wxBillRent.setCreatetime(new Date()); -// wxBillRentMapper.insertSelective(wxBillRent); -// } -// if(paycount==2){//6 -// BigDecimal needpay = wxRentContract.getPayArea().multiply(wxRentContract.getPrice()); -// BigDecimal needpaymoney = needpay.divide(new BigDecimal(2)).setScale(2, BigDecimal.ROUND_HALF_UP); -// for(int i=0;i list = wxRentContractMapper.findList(wxRentContract); + if (list.size() > 0) { + wxRentContract = list.get(0); + Integer receivePeriod = wxRentContract.getReceivePeriod(); + int paycount = 12 / receivePeriod.intValue(); + 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() * i; + wxBillRent.setNeedPay(needpay); + wxBillRent.setOwe(needpay); + + Date date = new Date(); + Calendar instance = Calendar.getInstance(); + instance.setTime(wxRentContract.getRentalStartDate()); + instance.add(Calendar.MONTH, receivePeriod.intValue() * i); + instance.add(Calendar.DAY_OF_MONTH, -1); + Date time = instance.getTime(); + wxBillRent.setReceiveDate(time); + //截止收租日在当前时间之前 + if (wxBillRent.getReceiveDate().before(date)) { + long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); + wxBillRent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); + wxBillRent.setExpiredDay(day); + wxBillRent.setReceiveDate(time); + } else {//截止收租日在当前时间之后 + Calendar now = Calendar.getInstance(); + now.add(Calendar.MONTH, receivePeriod.intValue() * i); + now.add(Calendar.DAY_OF_MONTH, -1); + Date currenttime = now.getTime(); + //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 + if(currenttime.before(wxBillRent.getReceiveDate())){ + wxBillRent.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); + wxBillRent.setExpiredDay(0L); + wxBillRent.setReceiveDate(time); + }else{ + wxBillRent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); + wxBillRent.setExpiredDay(0L); + wxBillRent.setReceiveDate(time); + } + } + wxBillRent.setTenantId(wxMerchant.getTenantId()); + wxBillRent.setIsDel(0); + wxBillRent.setMerchantId(wxMerchant.getId()); + wxBillRent.setUserId(user.getId()); + 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/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index ab39b968c..0d0e28c17 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -11,7 +11,7 @@ - +