diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxBillPropertyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxBillPropertyController.java new file mode 100644 index 000000000..beb0f335c --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxBillPropertyController.java @@ -0,0 +1,65 @@ +package com.iformall.controller; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBillProperty; +import com.iformall.service.WxBillPropertyService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +@RestController +@RequestMapping("wxBillProperty") +public class WxBillPropertyController extends BaseController +{ + @Autowired + private WxBillPropertyService wxBillPropertyService; + + private Logger logger = LoggerFactory.getLogger(WxBillPropertyController.class); + + @GetMapping("list") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), + @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) + public ResultData list(@ModelAttribute WxBillProperty wxBillProperty, Integer pageNum, Integer pageSize) { + if (null == wxBillProperty) wxBillProperty = new WxBillProperty(); + wxBillProperty.setTenantId(getTenantId()); + PageInfo> result = wxBillPropertyService.listAsPage(wxBillProperty, pageNum, pageSize); + return new ResultData(result); + } + + @PostMapping("add") + public ResultData add(@RequestBody WxBillProperty wxBillProperty) { + wxBillProperty.setTenantId(getTenantId()); + wxBillPropertyService.saveOrUpdate(wxBillProperty); + return new ResultData(); + } + + @PostMapping("update") + public ResultData update(@RequestBody WxBillProperty wxBillProperty) { + wxBillPropertyService.saveOrUpdate(wxBillProperty); + return new ResultData(); + } + + @GetMapping("/del") + @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) + public ResultData delete(Long id) { + wxBillPropertyService.deleteById(id); + return new ResultData(Result.SUCCESS, "删除成功", null); + } + + @GetMapping("/findById") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData findById(Long id) { + return new ResultData(Result.SUCCESS,"查询成功",wxBillPropertyService.getById(id)); + } + + + +} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxBillPropertyDepositController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxBillPropertyDepositController.java new file mode 100644 index 000000000..947e7a755 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxBillPropertyDepositController.java @@ -0,0 +1,68 @@ +package com.iformall.controller; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBillPropertyDeposit; +import com.iformall.service.WxBillPropertyDepositService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * @author gongbiao + */ +@RestController +@RequestMapping("wxBillPropertyDeposit") +public class WxBillPropertyDepositController extends BaseController +{ + @Autowired + private WxBillPropertyDepositService wxBillPropertyDepositService; + + private Logger logger = LoggerFactory.getLogger(WxBillPropertyDepositController.class); + + @GetMapping("list") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), + @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) + public ResultData list(@ModelAttribute WxBillPropertyDeposit wxBillPropertyDeposit, Integer pageNum, Integer pageSize) { + if (null == wxBillPropertyDeposit) wxBillPropertyDeposit = new WxBillPropertyDeposit(); + wxBillPropertyDeposit.setTenantId(getTenantId()); + PageInfo> result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); + return new ResultData(result); + } + + @PostMapping("add") + public ResultData add(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { + wxBillPropertyDeposit.setTenantId(getTenantId()); + wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); + return new ResultData(); + } + + @PostMapping("update") + public ResultData update(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { + wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); + return new ResultData(); + } + + @GetMapping("/del") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData delete(Long id) { + wxBillPropertyDepositService.deleteById(id); + return new ResultData(Result.SUCCESS, "删除成功", null); + } + + @GetMapping("/findById") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData findById(Long id) { + return new ResultData(Result.SUCCESS,"查询成功",wxBillPropertyDepositService.getById(id)); + } + + + +} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java new file mode 100644 index 000000000..7364125d6 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java @@ -0,0 +1,89 @@ +package com.iformall.controller; + +import com.iformall.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxPropertyContract; +import com.iformall.service.WxPropertyContractService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +/** + * @author gongbiao + */ +@RestController +@RequestMapping("wxPropertyContract") +public class WxPropertyContractController extends BaseController +{ + @Autowired + private WxPropertyContractService wxPropertyContractService; + + private Logger logger = LoggerFactory.getLogger(WxPropertyContractController.class); + + @GetMapping("list") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), + @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) + public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract,Integer pageNum, Integer pageSize) { + if (null == wxPropertyContract){ + wxPropertyContract = new WxPropertyContract(); + } + wxPropertyContract.setTenantId(getTenantId()); + Map result = wxPropertyContractService.listAsPage(wxPropertyContract, pageNum, pageSize); + return new ResultData(result); + } + + @PostMapping("add") + public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { + wxPropertyContract.setTenantId(getTenantId()); + return wxPropertyContractService.saveOrUpdate(wxPropertyContract); + } + + @PostMapping("update") + public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { + return wxPropertyContractService.saveOrUpdate(wxPropertyContract); + } + + @GetMapping("/del") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData delete(Long id) { + wxPropertyContractService.deleteById(id); + return new ResultData(Result.SUCCESS, "删除成功", null); + } + + @GetMapping("/findById") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData findById(Long id) { + return new ResultData(Result.SUCCESS,"查询成功",wxPropertyContractService.getById(id)); + } + + @RequestMapping("/download") + public void download(HttpServletRequest request, HttpServletResponse response){ + wxPropertyContractService.download(request,response,getTenantId()); + } + + @GetMapping("/getRentContractStatusInfo") + public ResultData getRentContractStatusInfo() { + return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractStatusInfo(getTenantId())); + } + + @GetMapping("/endRentContract") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + public ResultData endRentContract(Long id) { + return wxPropertyContractService.endRentContract(id); + } + + @GetMapping("/getRentContractList") + public ResultData getRentContractList() { + return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractList(getTenantId())); + } + + +} 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 23030d341..3d8f57a10 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java @@ -11,7 +11,7 @@ import java.util.List; /** * @author gongbiao */ -@Table(name = "wx_bill_deposit") +@Table(name = "wx_bill_rent_deposit") public class WxBillDeposit implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java new file mode 100644 index 000000000..a18dd0406 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java @@ -0,0 +1,259 @@ +package com.iformall.domain.po; + +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Table(name = "wx_bill_property") +public class WxBillProperty implements Serializable { + 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; + } + + + + /*租金合同ID**/ + @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") + private Long rentContractId; + /*实际应收金额**/ + @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") + private Integer receivePay; + /*实收金额**/ + @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") + private Integer pay; + /*收款日期**/ + @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") + private Date receiveDate; + /*到账日期**/ + @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") + private Date payDate; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") + private Date createtime; + /*逾期天数**/ + @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") + private Long expiredDay; + /*租户**/ + @io.swagger.annotations.ApiModelProperty(value="租户",name="tenantId") + private String tenantId; + /*欠缴**/ + @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") + private Integer owe; + /*账单状态1未到期2待缴3欠缴4已结清**/ + @io.swagger.annotations.ApiModelProperty(value="账单状态1未到期2待缴3欠缴4已结清",name="status") + private Integer status; + /*是否删除 是1否0 未到期不显示**/ + @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") + private Integer isDel; + /*应收金额**/ + @io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay") + private Integer needPay; + /*商户ID**/ + @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") + private Long merchantId; + /*账号ID**/ + @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") + private Long userId; + /*商铺ID**/ + @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") + private Long shopId; + /*更新时间**/ + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") + private Date updatetime; + public Long getRentContractId() { + return rentContractId; + } + public void setRentContractId(Long _rentContractId) { + rentContractId = _rentContractId; + } + public Integer getReceivePay() { + return receivePay; + } + public void setReceivePay(Integer _receivePay) { + receivePay = _receivePay; + } + public Integer getPay() { + return pay; + } + public void setPay(Integer _pay) { + pay = _pay; + } + public Date getReceiveDate() { + return receiveDate; + } + public void setReceiveDate(Date _receiveDate) { + receiveDate = _receiveDate; + } + public Date getPayDate() { + return payDate; + } + public void setPayDate(Date _payDate) { + payDate = _payDate; + } + public Date getCreatetime() { + return createtime; + } + public void setCreatetime(Date _createtime) { + createtime = _createtime; + } + public Long getExpiredDay() { + return expiredDay; + } + public void setExpiredDay(Long _expiredDay) { + expiredDay = _expiredDay; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String _tenantId) { + tenantId = _tenantId; + } + public Integer getOwe() { + return owe; + } + public void setOwe(Integer _owe) { + owe = _owe; + } + public Integer getStatus() { + return status; + } + public void setStatus(Integer _status) { + status = _status; + } + public Integer getIsDel() { + return isDel; + } + public void setIsDel(Integer _isDel) { + isDel = _isDel; + } + public Integer getNeedPay() { + return needPay; + } + public void setNeedPay(Integer _needPay) { + needPay = _needPay; + } + public Long getMerchantId() { + return merchantId; + } + public void setMerchantId(Long _merchantId) { + merchantId = _merchantId; + } + public Long getUserId() { + return userId; + } + public void setUserId(Long _userId) { + userId = _userId; + } + 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 static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,RentContractId_ASC("`rentContractId` ASC"),RentContractId_DESC("`rentContractId` DESC") + ,ReceivePay_ASC("`receivePay` ASC"),ReceivePay_DESC("`receivePay` DESC") + ,Pay_ASC("`pay` ASC"),Pay_DESC("`pay` DESC") + ,ReceiveDate_ASC("`receiveDate` ASC"),ReceiveDate_DESC("`receiveDate` DESC") + ,PayDate_ASC("`payDate` ASC"),PayDate_DESC("`payDate` DESC") + ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") + ,ExpiredDay_ASC("`expiredDay` ASC"),ExpiredDay_DESC("`expiredDay` DESC") + ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,Owe_ASC("`owe` ASC"),Owe_DESC("`owe` DESC") + ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") + ,IsDel_ASC("`isDel` ASC"),IsDel_DESC("`isDel` DESC") + ,NeedPay_ASC("`needPay` ASC"),NeedPay_DESC("`needPay` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") + ,UserId_ASC("`userId` ASC"),UserId_DESC("`userId` DESC") + ,ShopId_ASC("`shopId` ASC"),ShopId_DESC("`shopId` DESC") + ,Updatetime_ASC("`updatetime` ASC"),Updatetime_DESC("`updatetime` 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()); + } + + } + + 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/domain/po/WxBillPropertyDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java new file mode 100644 index 000000000..178b0eade --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java @@ -0,0 +1,259 @@ +package com.iformall.domain.po; + +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Table(name = "wx_bill_property_deposit") +public class WxBillPropertyDeposit implements Serializable { + 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; + } + + + + /*租金合同ID**/ + @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") + private Long rentContractId; + /*实际应收金额**/ + @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") + private Integer receivePay; + /*实收金额**/ + @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") + private Integer pay; + /*收款日期**/ + @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") + private Date receiveDate; + /*到账日期**/ + @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") + private Date payDate; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") + private Date createtime; + /*逾期天数**/ + @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") + private Long expiredDay; + /*租户**/ + @io.swagger.annotations.ApiModelProperty(value="租户",name="tenantId") + private String tenantId; + /*欠缴**/ + @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") + private Integer owe; + /*账单状态1未到期2待缴3欠缴4已结清**/ + @io.swagger.annotations.ApiModelProperty(value="账单状态1未到期2待缴3欠缴4已结清",name="status") + private Integer status; + /*是否删除 是1否0 未到期不显示**/ + @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") + private Integer isDel; + /*应收金额**/ + @io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay") + private Integer needPay; + /*商户ID**/ + @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") + private Long merchantId; + /*账号ID**/ + @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") + private Long userId; + /*商铺ID**/ + @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") + private Long shopId; + /*更新时间**/ + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") + private Date updatetime; + public Long getRentContractId() { + return rentContractId; + } + public void setRentContractId(Long _rentContractId) { + rentContractId = _rentContractId; + } + public Integer getReceivePay() { + return receivePay; + } + public void setReceivePay(Integer _receivePay) { + receivePay = _receivePay; + } + public Integer getPay() { + return pay; + } + public void setPay(Integer _pay) { + pay = _pay; + } + public Date getReceiveDate() { + return receiveDate; + } + public void setReceiveDate(Date _receiveDate) { + receiveDate = _receiveDate; + } + public Date getPayDate() { + return payDate; + } + public void setPayDate(Date _payDate) { + payDate = _payDate; + } + public Date getCreatetime() { + return createtime; + } + public void setCreatetime(Date _createtime) { + createtime = _createtime; + } + public Long getExpiredDay() { + return expiredDay; + } + public void setExpiredDay(Long _expiredDay) { + expiredDay = _expiredDay; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String _tenantId) { + tenantId = _tenantId; + } + public Integer getOwe() { + return owe; + } + public void setOwe(Integer _owe) { + owe = _owe; + } + public Integer getStatus() { + return status; + } + public void setStatus(Integer _status) { + status = _status; + } + public Integer getIsDel() { + return isDel; + } + public void setIsDel(Integer _isDel) { + isDel = _isDel; + } + public Integer getNeedPay() { + return needPay; + } + public void setNeedPay(Integer _needPay) { + needPay = _needPay; + } + public Long getMerchantId() { + return merchantId; + } + public void setMerchantId(Long _merchantId) { + merchantId = _merchantId; + } + public Long getUserId() { + return userId; + } + public void setUserId(Long _userId) { + userId = _userId; + } + 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 static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,RentContractId_ASC("`rentContractId` ASC"),RentContractId_DESC("`rentContractId` DESC") + ,ReceivePay_ASC("`receivePay` ASC"),ReceivePay_DESC("`receivePay` DESC") + ,Pay_ASC("`pay` ASC"),Pay_DESC("`pay` DESC") + ,ReceiveDate_ASC("`receiveDate` ASC"),ReceiveDate_DESC("`receiveDate` DESC") + ,PayDate_ASC("`payDate` ASC"),PayDate_DESC("`payDate` DESC") + ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") + ,ExpiredDay_ASC("`expiredDay` ASC"),ExpiredDay_DESC("`expiredDay` DESC") + ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,Owe_ASC("`owe` ASC"),Owe_DESC("`owe` DESC") + ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") + ,IsDel_ASC("`isDel` ASC"),IsDel_DESC("`isDel` DESC") + ,NeedPay_ASC("`needPay` ASC"),NeedPay_DESC("`needPay` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") + ,UserId_ASC("`userId` ASC"),UserId_DESC("`userId` DESC") + ,ShopId_ASC("`shopId` ASC"),ShopId_DESC("`shopId` DESC") + ,Updatetime_ASC("`updatetime` ASC"),Updatetime_DESC("`updatetime` 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()); + } + + } + + 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/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java new file mode 100644 index 000000000..125ab99fd --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -0,0 +1,382 @@ +package com.iformall.domain.po; + +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @author gongbiao + */ +@Table(name = "wx_property_contract") +public class WxPropertyContract implements Serializable { + 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 Integer 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:参照wx_business表**/ + @io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId") + private Long businessId; + /*店铺类型:1直营店2加盟店3个体店4旗舰店**/ + @io.swagger.annotations.ApiModelProperty(value="店铺类型:1直营店2加盟店3个体店4旗舰店",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; + /*上传文件名**/ + @io.swagger.annotations.ApiModelProperty(value="上传文件名",name="filename") + private String filename; + /*租期:月**/ + @io.swagger.annotations.ApiModelProperty(value="租期:月",name="lease") + private Integer lease; + /*租金合同ID**/ + @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") + private Long rentContractId; + 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 Integer getDeposit() { + return deposit; + } + public void setDeposit(Integer _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) { + createtime = _createtime; + } + public String getRentArea() { + return rentArea; + } + public void setRentArea(String _rentArea) { + rentArea = _rentArea; + } + public String getLinkPerson() { + return linkPerson; + } + public void setLinkPerson(String _linkPerson) { + linkPerson = _linkPerson; + } + public String getLinkPhone() { + return linkPhone; + } + public void setLinkPhone(String _linkPhone) { + linkPhone = _linkPhone; + } + public String getPayAccount() { + return payAccount; + } + public void setPayAccount(String _payAccount) { + payAccount = _payAccount; + } + public String getFilename() { + return filename; + } + public void setFilename(String _filename) { + filename = _filename; + } + public Integer getLease() { + return lease; + } + public void setLease(Integer _lease) { + lease = _lease; + } + public Long getRentContractId() { + return rentContractId; + } + public void setRentContractId(Long _rentContractId) { + rentContractId = _rentContractId; + } + + + + public static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") + ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") + ,RentalStartDate_ASC("`rentalStartDate` ASC"),RentalStartDate_DESC("`rentalStartDate` DESC") + ,RentalEndDate_ASC("`rentalEndDate` ASC"),RentalEndDate_DESC("`rentalEndDate` DESC") + ,SignDate_ASC("`signDate` ASC"),SignDate_DESC("`signDate` DESC") + ,ReceivePeriod_ASC("`receivePeriod` ASC"),ReceivePeriod_DESC("`receivePeriod` DESC") + ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,Filepath_ASC("`filepath` ASC"),Filepath_DESC("`filepath` DESC") + ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") + ,ContractNumber_ASC("`contractNumber` ASC"),ContractNumber_DESC("`contractNumber` DESC") + ,Deposit_ASC("`deposit` ASC"),Deposit_DESC("`deposit` DESC") + ,PayDate_ASC("`payDate` ASC"),PayDate_DESC("`payDate` DESC") + ,IsDel_ASC("`isDel` ASC"),IsDel_DESC("`isDel` DESC") + ,MerchantName_ASC("`merchantName` ASC"),MerchantName_DESC("`merchantName` DESC") + ,Brand_ASC("`brand` ASC"),Brand_DESC("`brand` DESC") + ,BusinessId_ASC("`businessId` ASC"),BusinessId_DESC("`businessId` DESC") + ,ShopType_ASC("`shopType` ASC"),ShopType_DESC("`shopType` DESC") + ,ShopId_ASC("`shopId` ASC"),ShopId_DESC("`shopId` DESC") + ,Updatetime_ASC("`updatetime` ASC"),Updatetime_DESC("`updatetime` DESC") + ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") + ,RentArea_ASC("`rentArea` ASC"),RentArea_DESC("`rentArea` DESC") + ,LinkPerson_ASC("`linkPerson` ASC"),LinkPerson_DESC("`linkPerson` DESC") + ,LinkPhone_ASC("`linkPhone` ASC"),LinkPhone_DESC("`linkPhone` DESC") + ,PayAccount_ASC("`payAccount` ASC"),PayAccount_DESC("`payAccount` DESC") + ,Filename_ASC("`filename` ASC"),Filename_DESC("`filename` DESC") + ,Lease_ASC("`lease` ASC"),Lease_DESC("`lease` DESC") + ,RentContractId_ASC("`rentContractId` ASC"),RentContractId_DESC("`rentContractId` 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()); + } + + } + + 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/mapper/WxBillPropertyDepositMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyDepositMapper.java new file mode 100644 index 000000000..e75568a1f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyDepositMapper.java @@ -0,0 +1,27 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxBillPropertyDeposit; + +import java.util.List; +import java.util.Map; + +/** + * @author gongbiao + */ +public interface WxBillPropertyDepositMapper extends CommonMapper { + + List findList(WxBillPropertyDeposit wxBillPropertyDeposit); + + List> queryBillDepositList(WxBillPropertyDeposit record); + + Map queryPayInfo(Map params); + + void updateNotPaidStatus(Map params); + + void updateWaitPayStatus(Map params); + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java new file mode 100644 index 000000000..ab450aecb --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java @@ -0,0 +1,27 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxBillProperty; + +import java.util.List; +import java.util.Map; + +/** + * @author gongbiao + */ +public interface WxBillPropertyMapper extends CommonMapper { + + List findList(WxBillProperty wxBillProperty); + + List> queryBillRentList(WxBillProperty record); + + Map queryPayInfo(Map params); + + void updateNotPaidStatus(Map params); + + void updateWaitPayStatus(Map params); + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java new file mode 100644 index 000000000..009bced9d --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java @@ -0,0 +1,41 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxPropertyContract; + +import java.util.List; +import java.util.Map; + +/** + * @author gongbiao + */ +public interface WxPropertyContractMapper extends CommonMapper { + + List findList(WxPropertyContract wxPropertyContract); + + List> queryRentContractData(WxPropertyContract wxRentContract); + + int queryRentContractWaitSignStatus(WxPropertyContract wxRentContract); + + int queryRentContractEndSoonStatus(WxPropertyContract wxRentContract); + + int queryRentContractPaidStatus(WxPropertyContract wxRentContract); + + int queryRentContractEndStatus(WxPropertyContract wxRentContract); + + int updateRentContractEndSoonStatus(WxPropertyContract wxRentContract); + + int updateRentContractPaidStatus(WxPropertyContract wxRentContract); + + int updateRentContractEndStatus(WxPropertyContract wxRentContract); + + void updateRentWaitSignStatus(WxPropertyContract wxRentContract); + + void updateRentInvalidStatus(WxPropertyContract wxRentContract); + + List getRentContractList(String tenantId); + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyDepositService.java b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyDepositService.java new file mode 100644 index 000000000..0be45d549 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyDepositService.java @@ -0,0 +1,57 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBillDeposit; +import com.iformall.domain.po.WxBillPropertyDeposit; + +import java.util.Map; + +/** + * @author gongbiao + */ +public interface WxBillPropertyDepositService { + + /** + * 根据实体查询分页列表 + * + * @param offset + * @param limit + * @param record + * @return + */ + PageInfo> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + Map getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + ResultData saveOrUpdate(WxBillPropertyDeposit record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + ResultData updatePaid(Long id); + + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java new file mode 100644 index 000000000..fdf9ad31e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java @@ -0,0 +1,56 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBillProperty; +import com.iformall.domain.po.WxBillRent; + +import java.util.Map; + +/** + * @author gongbiao + */ +public interface WxBillPropertyService { + + + /** + * 根据实体查询分页列表 + * + * @param offset + * @param limit + * @param record + * @return + */ + PageInfo> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + Map getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + ResultData saveOrUpdate(WxBillProperty record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + Object findByMerchantId(Long id); + + ResultData updatePaid(Long id); + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java new file mode 100644 index 000000000..7db95d74b --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java @@ -0,0 +1,62 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxRentContract; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +/** + * @author gongbiao + */ +public interface WxPropertyContractService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param offset + * @param limit + * @return + */ + Map listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxPropertyContract getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + ResultData saveOrUpdate(WxPropertyContract record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + void download(HttpServletRequest request, HttpServletResponse response, String tenantId); + + Object getRentContractStatusInfo(String tenantId); + + ResultData endRentContract(Long id); + + Object getRentContractList(String tenantId); + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java new file mode 100644 index 000000000..c70e5b526 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java @@ -0,0 +1,144 @@ +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.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBillDeposit; +import com.iformall.domain.po.WxBillPropertyDeposit; +import com.iformall.enums.EnumBillRentStatus; +import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxBillPropertyDepositMapper; +import com.iformall.service.WxBillPropertyDepositService; +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.*; + +/** + * @author gongbiao + */ +@Service +public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + WxBillPropertyDepositMapper wxBillPropertyDepositMapper; + + + @Override + public PageInfo> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { + //更新逾期天数及状态 + updateNotPaidStatus(record); + //更新待缴的状态 + updateWaidPayStatus(record); + PageHelper.startPage(pageIndex, pageSize); + List> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); + PageInfo> pageInfo = new PageInfo<>(billDepositList); + return pageInfo; + } + + + @Transactional(rollbackFor = {Exception.class}) + public void updateWaidPayStatus(WxBillPropertyDeposit record) { + Map params = new HashMap<>(); + params.put("tenantId", record.getTenantId()); + params.put("waitPay", EnumBillRentStatus.WAIT_PAY.getCode()); + params.put("paid", EnumBillRentStatus.PAID.getCode()); + + try { + wxBillPropertyDepositMapper.updateWaitPayStatus(params); + } 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 updateNotPaidStatus(WxBillPropertyDeposit record) { + Map params = new HashMap<>(); + params.put("tenantId", record.getTenantId()); + params.put("notPaid", EnumBillRentStatus.NOT_PAID.getCode()); + params.put("paid", EnumBillRentStatus.PAID.getCode()); + try { + wxBillPropertyDepositMapper.updateNotPaidStatus(params); + } catch (Exception e) { + logger.error("更新物业欠缴账单状态失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + } + + @Override + public Map getById(Long id) { + WxBillPropertyDeposit record = new WxBillPropertyDeposit(); + record.setId(id); + return wxBillPropertyDepositMapper.queryBillDepositList(record).get(0); + } + + @Override + public ResultData saveOrUpdate(WxBillPropertyDeposit record) { + + if (record.getId() == null) { + logger.info("新增物业押金账单"); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + Date date = new Date(); + record.setCreatetime(date); + record.setUpdatetime(date); + try { + wxBillPropertyDepositMapper.insertSelective(record); + } catch (Exception e) { + logger.error("保存物业押金账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "保存物业押金账单成功"); + } else { + logger.info("更新押金账单"); + WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(record.getId()); + wxBillDeposit.setPayDate(record.getPayDate()); + wxBillDeposit.setPay(record.getPay()*100); + wxBillDeposit.setReceivePay(record.getReceivePay()*100); + wxBillDeposit.setOwe(record.getOwe()*100); + wxBillDeposit.setStatus(record.getPay().equals(record.getReceivePay())?EnumBillRentStatus.PAID.getCode():wxBillDeposit.getStatus()); + wxBillDeposit.setUpdatetime(new Date()); + try { + wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); + } catch (Exception e) { + logger.error("更新物业押金账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "更新物业押金账单成功"); + } + } + + @Override + public void deleteById(Long id) { + wxBillPropertyDepositMapper.deleteByPrimaryKey(id); + } + + @Transactional(rollbackFor = {Exception.class}) + @Override + public ResultData updatePaid(Long id) { + WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(id); + wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); + try { + wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); + } catch (Exception e) { + logger.error("物业押金结单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "物业押金结单成功"); + } + + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java new file mode 100644 index 000000000..1505366d0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java @@ -0,0 +1,148 @@ +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.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxBillProperty; +import com.iformall.domain.po.WxBillPropertyDeposit; +import com.iformall.domain.po.WxBillRent; +import com.iformall.enums.EnumBillRentStatus; +import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxBillPropertyMapper; +import com.iformall.service.WxBillPropertyService; +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.*; + +/** + * @author gongbiao + */ +@Service +public class WxBillPropertyServiceImpl implements WxBillPropertyService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + WxBillPropertyMapper wxBillPropertyMapper; + + @Override + public PageInfo> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { + //更新逾期天数及状态 + updateNotPaidStatus(record); + //更新待缴的状态 + updateWaidPayStatus(record); + PageHelper.startPage(pageIndex, pageSize); + List> billRentList = wxBillPropertyMapper.queryBillRentList(record); + PageInfo> pageInfo = new PageInfo<>(billRentList); + return pageInfo; + } + + @Transactional(rollbackFor = {Exception.class}) + public void updateWaidPayStatus(WxBillProperty record) { + Map params = new HashMap<>(); + params.put("tenantId", record.getTenantId()); + params.put("waitPay", EnumBillRentStatus.WAIT_PAY.getCode()); + params.put("paid", EnumBillRentStatus.PAID.getCode()); + + try { + wxBillPropertyMapper.updateWaitPayStatus(params); + } 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 updateNotPaidStatus(WxBillProperty record) { + Map params = new HashMap<>(); + params.put("tenantId", record.getTenantId()); + params.put("notPaid", EnumBillRentStatus.NOT_PAID.getCode()); + params.put("paid", EnumBillRentStatus.PAID.getCode()); + try { + wxBillPropertyMapper.updateNotPaidStatus(params); + } catch (Exception e) { + logger.error("更新物业欠缴账单状态失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + } + + @Override + public Map getById(Long id) { + WxBillProperty record = new WxBillProperty(); + record.setId(id); + return wxBillPropertyMapper.queryBillRentList(record).get(0); + } + + @Override + public ResultData saveOrUpdate(WxBillProperty record) { + if (record.getId() == null) { + logger.info("新增物业账单"); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + Date date = new Date(); + record.setCreatetime(date); + record.setUpdatetime(date); + try { + wxBillPropertyMapper.insertSelective(record); + } catch (Exception e) { + logger.error("保存物业账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "保存物业账单成功"); + } else { + logger.info("更新物业账单"); + WxBillProperty wxBillRent = wxBillPropertyMapper.selectByPrimaryKey(record.getId()); + wxBillRent.setPayDate(record.getPayDate()); + wxBillRent.setPay(record.getPay()*100); + wxBillRent.setReceivePay(record.getReceivePay()*100); + wxBillRent.setOwe(record.getOwe()*100); + wxBillRent.setStatus(record.getPay().equals(record.getReceivePay())?EnumBillRentStatus.PAID.getCode():wxBillRent.getStatus()); + wxBillRent.setUpdatetime(new Date()); + try { + wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillRent); + } catch (Exception e) { + logger.error("更新物业账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "更新物业账单成功"); + } + } + + @Override + public void deleteById(Long id) { + wxBillPropertyMapper.deleteByPrimaryKey(id); + } + + @Override + public Object findByMerchantId(Long id) { + WxBillProperty record = new WxBillProperty(); + record.setMerchantId(id); + return wxBillPropertyMapper.queryBillRentList(record); + } + + @Transactional(rollbackFor = {Exception.class}) + @Override + public ResultData updatePaid(Long id) { + WxBillProperty wxBillRent = wxBillPropertyMapper.selectByPrimaryKey(id); + wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); + try { + wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillRent); + } catch (Exception e) { + logger.error("结单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "结单成功"); + } + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java new file mode 100644 index 000000000..e35a1f2f1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -0,0 +1,383 @@ +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.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.enums.EnumBillRentStatus; +import com.iformall.enums.EnumRentContractStatus; +import com.iformall.enums.EnumShopStatus; +import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxBillPropertyDepositMapper; +import com.iformall.mapper.WxBillPropertyMapper; +import com.iformall.mapper.WxPropertyContractMapper; +import com.iformall.mapper.WxShopMapper; +import com.iformall.service.WxPropertyContractService; +import com.iformall.utils.Constant; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.*; + +/** + * @author gongbiao + */ +@Service +public class WxPropertyContractServiceImpl implements WxPropertyContractService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + WxPropertyContractMapper wxPropertyContractMapper; + + @Autowired + WxShopMapper wxShopMapper; + + @Autowired + WxBillPropertyMapper wxBillPropertyMapper; + + @Autowired + WxBillPropertyDepositMapper wxBillPropertyDepositMapper; + + @Override + public Map listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { + Object rentContractStatusInfo = getRentContractStatusInfo(record.getTenantId()); + PageHelper.startPage(pageIndex, pageSize); + List> rentContractData = wxPropertyContractMapper.queryRentContractData(record); + PageInfo> pageInfo = new PageInfo<>(rentContractData); + Map result = new HashMap<>(); + result.put("rentContractStatusInfo", rentContractStatusInfo); + result.put("pageInfo", pageInfo); + return result; + + } + + @Override + public WxPropertyContract getById(Long id) { + return wxPropertyContractMapper.selectByPrimaryKey(id); + } + + @Override + public ResultData saveOrUpdate(WxPropertyContract record) { + + return null; + } + + @Transactional(rollbackFor = {Exception.class}) + public void buildDeposit(WxMerchant wxMerchant) { + MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); + WxPropertyContract wxPropertyContract = new WxPropertyContract(); + wxPropertyContract.setMerchantId(wxMerchant.getId()); + List list = wxPropertyContractMapper.findList(wxPropertyContract); + if (list.size() > 0) { + wxPropertyContract = list.get(0); + Integer receivePeriod = wxPropertyContract.getReceivePeriod(); + final IdWorker idWorker = IdWorker.get(); + WxBillPropertyDeposit wxBillDeposit = new WxBillPropertyDeposit(); + wxBillDeposit.setId(idWorker.nextId()); + wxBillDeposit.setRentContractId(wxPropertyContract.getId()); + wxBillDeposit.setReceivePay(0); + wxBillDeposit.setPay(0); + int needpay = wxPropertyContract.getDeposit(); + wxBillDeposit.setNeedPay(needpay); + wxBillDeposit.setOwe(needpay); + + Date date = new Date(); + Calendar instance = Calendar.getInstance(); + instance.setTime(wxPropertyContract.getRentalStartDate()); + instance.add(Calendar.MONTH, receivePeriod.intValue()); + instance.add(Calendar.DAY_OF_MONTH, -1); + Date time = instance.getTime(); + wxBillDeposit.setReceiveDate(time); + //截止收租日在当前时间之前 + if (wxBillDeposit.getReceiveDate().before(date)) { + long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); + wxBillDeposit.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); + wxBillDeposit.setExpiredDay(day); + wxBillDeposit.setReceiveDate(time); + } else { + wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); + wxBillDeposit.setExpiredDay(0L); + wxBillDeposit.setReceiveDate(time); + } + + wxBillDeposit.setTenantId(wxMerchant.getTenantId()); + wxBillDeposit.setIsDel(0); + wxBillDeposit.setMerchantId(wxMerchant.getId()); + wxBillDeposit.setUserId(user.getId()); + wxBillDeposit.setShopId(wxPropertyContract.getShopId()); + wxBillDeposit.setCreatetime(date); + wxBillDeposit.setUpdatetime(date); + try { + wxBillPropertyDepositMapper.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) { + + //获取用户 + MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); + + //根据商户ID找出合同 + WxPropertyContract wxPropertyContract = new WxPropertyContract(); + wxPropertyContract.setMerchantId(wxMerchant.getId()); + List list = wxPropertyContractMapper.findList(wxPropertyContract); + if (list.size() > 0) { + wxPropertyContract = list.get(0); + Integer receivePeriod = wxPropertyContract.getReceivePeriod(); + int paycount = 12 / receivePeriod.intValue(); + final IdWorker idWorker = IdWorker.get(); + for (int i = 0; i < paycount; i++) { + WxBillProperty wxBillRent = new WxBillProperty(); + wxBillRent.setId(idWorker.nextId()); + wxBillRent.setRentContractId(wxPropertyContract.getId()); + wxBillRent.setReceivePay(0); + wxBillRent.setPay(0); + int needpay = wxPropertyContract.getPrice(); + wxBillRent.setNeedPay(needpay); + wxBillRent.setOwe(needpay); + + Date date = new Date(); + Calendar instance = Calendar.getInstance(); + instance.setTime(wxPropertyContract.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()); + 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(wxPropertyContract.getShopId()); + wxBillRent.setCreatetime(date); + wxBillRent.setUpdatetime(date); + try { + wxBillPropertyMapper.insertSelective(wxBillRent); + } catch (Exception e) { + logger.error("添加租赁账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + } + + } + } + + + + @Override + public void deleteById(Long id) { + wxPropertyContractMapper.deleteByPrimaryKey(id); + } + + + @Override + public void download(HttpServletRequest request, HttpServletResponse response, String tenantId) { + String id = request.getParameter("id"); + WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(id); + + String filesuffix = wxPropertyContract.getFilepath().substring(wxPropertyContract.getFilepath().lastIndexOf(".")); + String filename = UUID.randomUUID() + filesuffix; + String filepath = Constant.fileDirectory; + String destPath = filepath + filename; + File dest = new File(destPath); + File pDest = dest.getParentFile(); + if (!pDest.exists()) { + pDest.mkdirs(); + } + try { + downLoadFromUrl(wxPropertyContract.getFilepath(), filename, filepath); + downFile(destPath, wxPropertyContract.getFilename(), response, request); + org.apache.commons.io.FileUtils.forceDelete(dest); + } catch (IOException e) { + logger.info("创建本地文件失败" + e.getMessage()); + } + } + + @Transactional(rollbackFor = {Exception.class}) + @Override + public Object getRentContractStatusInfo(String tenantId) { + + Map resultData = new HashMap(); + //商铺信息 + Map shopparams = new HashMap<>(); + shopparams.put("tenantId", tenantId); + shopparams.put("status", EnumShopStatus.NOT_RENT.getCode()); + Map shopLeftInfo = wxShopMapper.queryShopLeftInfo(shopparams); + resultData.put("shopLeftInfo", shopLeftInfo); + + //需要更新的状态 + resultData.putAll(updateStatus(tenantId)); + return resultData; + } + + @Transactional(rollbackFor = {Exception.class}) + @Override + public ResultData endRentContract(Long id) { + + WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(id); + wxPropertyContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); + try { + wxPropertyContractMapper.updateByPrimaryKeySelective(wxPropertyContract); + //停用商户 +// wxMerchantService.disable(wxRentContract.getMerchantId()); + } catch (MallinkException e) { + logger.info("终止合同失败:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + return new ResultData(Result.SUCCESS, "操作成功"); + } + + + @Override + public Object getRentContractList(String tenantId) { + + return wxPropertyContractMapper.getRentContractList(tenantId); + } + + public Map updateStatus(String tenantId) { + Map resultData = new HashMap(); + WxPropertyContract wxRentContract = new WxPropertyContract(); + wxRentContract.setTenantId(tenantId); + + //作废合同 + wxRentContract.setStatus(EnumRentContractStatus.INVALID.getCode()); + wxPropertyContractMapper.updateRentInvalidStatus(wxRentContract); + + //待签约 + wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); + wxPropertyContractMapper.updateRentWaitSignStatus(wxRentContract); + int waitSignCount = wxPropertyContractMapper.queryRentContractWaitSignStatus(wxRentContract); + resultData.put("waitSignCount", waitSignCount); + + //计租中 + wxRentContract.setStatus(EnumRentContractStatus.RENT_PAID.getCode()); + int rendPaidCount = wxPropertyContractMapper.queryRentContractPaidStatus(wxRentContract); + wxPropertyContractMapper.updateRentContractPaidStatus(wxRentContract); + resultData.put("rendPaidCount", rendPaidCount); + + //将到期 + wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END_SOON.getCode()); + int endSoonCount = wxPropertyContractMapper.queryRentContractEndSoonStatus(wxRentContract); + wxPropertyContractMapper.updateRentContractEndSoonStatus(wxRentContract); + resultData.put("endSoonCount", endSoonCount); + + //到期 + wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END.getCode()); + int endCount = wxPropertyContractMapper.queryRentContractEndStatus(wxRentContract); + wxPropertyContractMapper.updateRentContractEndStatus(wxRentContract); + resultData.put("endCount", endCount); + + return resultData; + } + + public static void downLoadFromUrl(String urlStr, String fileName, String savePath) throws IOException { + URL url = new URL(urlStr); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + //设置超时间为3秒 + conn.setConnectTimeout(3 * 1000); + //防止屏蔽程序抓取而返回403错误 + conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); + + //得到输入流 + InputStream inputStream = conn.getInputStream(); + //获取自己数组 + byte[] getData = readInputStream(inputStream); + + //文件保存位置 + File saveDir = new File(savePath); + if (!saveDir.exists()) { + saveDir.mkdir(); + } + File file = new File(saveDir + File.separator + fileName); + FileOutputStream fos = new FileOutputStream(file); + fos.write(getData); + if (fos != null) { + fos.close(); + } + if (inputStream != null) { + inputStream.close(); + } + + + System.out.println("info:" + url + " download success"); + + } + + public static byte[] readInputStream(InputStream inputStream) throws IOException { + byte[] buffer = new byte[1024]; + int len = 0; + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + while ((len = inputStream.read(buffer)) != -1) { + bos.write(buffer, 0, len); + } + bos.close(); + return bos.toByteArray(); + } + + public void downFile(String filePath, String filename, HttpServletResponse response, + HttpServletRequest req) { + try { + response.reset(); + response.setContentType("bin"); + String agent = req.getHeader("user-agent"); + if (agent.contains("Firefox")) { + response.setHeader("Content-disposition", "attachment; filename=" + new String(filename.getBytes("GB2312"), "ISO-8859-1")); + } else { + response.setHeader("Content-disposition", "attachment; filename=" + java.net.URLEncoder.encode(filename, "UTF-8")); + } + // 循环取出流中的数据 + byte[] b = new byte[1024]; + int len; + InputStream inStream = new FileInputStream(filePath); + while ((len = inStream.read(b)) > 0) + response.getOutputStream().write(b, 0, len); + inStream.close(); + } catch (Exception e) { + logger.info("下载合同失败" + e.getMessage()); + e.printStackTrace(); + } + } + + + + + +} 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 aebe0ec9c..6e88ac771 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -71,7 +71,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { Map result = new HashMap<>(); WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() / 100 : 0); - wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() * 100 : 0); + wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() / 100 : 0); result.put("wxRentContract", wxRentContract); //关联的商户 diff --git a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml index 7f7bdf8de..6d928372f 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml @@ -54,7 +54,7 @@ @@ -64,7 +64,7 @@ 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 - from wx_bill_deposit br left join wx_merchant m on br.merchant_id=m.id + 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 and br.`id` = #{id} @@ -79,19 +79,19 @@ - update wx_bill_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) + update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0 - update wx_bill_deposit set status=#{waitPay} where id in( - select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_deposit br + update wx_bill_rent_deposit set status=#{waitPay} where id in( + select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_deposit br left join wx_rent_contract rc on br.rent_contract_id=rc.id where br.tenant_id=#{tenantId} and br.status!=#{paid} and now() < br.receive_date and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml new file mode 100644 index 000000000..b703f532f --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + `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` + + + + where 1 = 1 + and `id` = #{id} + and `rent_contract_id` = #{rentContractId} + and `receive_pay` = #{receivePay} + and `pay` = #{pay} + and `receive_date` = #{receiveDate} + and `pay_date` = #{payDate} + and `createtime` = #{createtime} + and `expired_day` = #{expiredDay} + and `tenant_id` = #{tenantId} + and `owe` = #{owe} + and `status` = #{status} + and `is_del` = #{isDel} + and `need_pay` = #{needPay} + and `merchant_id` = #{merchantId} + and `user_id` = #{userId} + and `shop_id` = #{shopId} + and `updatetime` = #{updatetime} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) + where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0 + + + + update wx_bill_property_deposit set status=#{waitPay} where id in( + select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_property_deposit br + left join wx_rent_contract rc on br.rent_contract_id=rc.id + where br.tenant_id=#{tenantId} and br.status!=#{paid} and now() < br.receive_date + and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml new file mode 100644 index 000000000..402f55359 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + `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` + + + + where 1 = 1 + and `id` = #{id} + and `rent_contract_id` = #{rentContractId} + and `receive_pay` = #{receivePay} + and `pay` = #{pay} + and `receive_date` = #{receiveDate} + and `pay_date` = #{payDate} + and `createtime` = #{createtime} + and `expired_day` = #{expiredDay} + and `tenant_id` = #{tenantId} + and `owe` = #{owe} + and `status` = #{status} + and `is_del` = #{isDel} + and `need_pay` = #{needPay} + and `merchant_id` = #{merchantId} + and `user_id` = #{userId} + and `shop_id` = #{shopId} + and `updatetime` = #{updatetime} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + update wx_bill_property set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) + where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0 + + + + update wx_bill_property set status=#{waitPay} where id in( + select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_property br + left join wx_rent_contract rc on br.rent_contract_id=rc.id + where br.tenant_id=#{tenantId} and br.status!=#{paid} and now() < br.receive_date + and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml new file mode 100644 index 000000000..6d81edffa --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`rent_area`,`link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id` + + + + where 1 = 1 + and `id` = #{id} + and `merchant_id` = #{merchantId} + and `price` = #{price} + and `rental_start_date` = #{rentalStartDate} + and `rental_end_date` = #{rentalEndDate} + and `sign_date` = #{signDate} + and `receive_period` = #{receivePeriod} + and `tenant_id` = #{tenantId} + and `filepath` = #{filepath} + and `status` = #{status} + and `contract_number` = #{contractNumber} + and `deposit` = #{deposit} + and `pay_date` = #{payDate} + and `is_del` = #{isDel} + and `merchant_name` = #{merchantName} + and `brand` = #{brand} + and `business_id` = #{businessId} + and `shop_type` = #{shopType} + and `shop_id` = #{shopId} + and `updatetime` = #{updatetime} + and `createtime` = #{createtime} + and `rent_area` = #{rentArea} + and `link_person` = #{linkPerson} + and `link_phone` = #{linkPhone} + and `pay_account` = #{payAccount} + and `filename` = #{filename} + and `lease` = #{lease} + and `rent_contract_id` = #{rentContractId} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + + + + + + + update wx_property_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) <= 30 + + + + update wx_property_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date <= now() and rental_end_date >= now() + + + + update wx_property_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date <now() + + + + update wx_property_contract set status=#{status} where tenant_id=#{tenantId} and status!=7 and merchant_id is null + + + + update wx_property_contract set status=#{status} where shop_id in ( + select s.shop_id from (SELECT shop_id FROM wx_property_contract WHERE tenant_id = #{tenantId} and merchant_id is not null and status!=6 + )s) and merchant_id is null and tenant_id=#{tenantId} + + + + + +