| @@ -10,53 +10,69 @@ import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxRentContract") | |||
| public class WxRentContractController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @Autowired | |||
| private WxRentContractService wxRentContractService; | |||
| @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 WxRentContract wxRentContract,Integer pageNum, Integer pageSize) { | |||
| if (null == wxRentContract) wxRentContract = new WxRentContract(); | |||
| final PageInfo<WxRentContract> page = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| @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 WxRentContract wxRentContract, Integer pageNum, Integer pageSize) { | |||
| if (null == wxRentContract) { | |||
| wxRentContract = new WxRentContract(); | |||
| } | |||
| final PageInfo<Map<String, Object>> page = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | |||
| //Assert.notNull(wxRentContract.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxRentContractService.saveOrUpdate(wxRentContract); | |||
| return new ResultData(); | |||
| return wxRentContractService.saveOrUpdate(wxRentContract); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | |||
| wxRentContractService.saveOrUpdate(wxRentContract); | |||
| return new ResultData(); | |||
| return wxRentContractService.saveOrUpdate(wxRentContract); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| wxRentContractService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| return wxRentContractService.deleteById(id); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxRentContractService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getById(id)); | |||
| } | |||
| @RequestMapping("/download") | |||
| public void download(HttpServletRequest request, HttpServletResponse response){ | |||
| wxRentContractService.download(request,response,getTenantId()); | |||
| } | |||
| @GetMapping("/getRentContractStatusInfo") | |||
| public ResultData getRentContractStatusInfo() { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getRentContractStatusInfo(getTenantId())); | |||
| } | |||
| } | |||
| @@ -4,11 +4,13 @@ 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; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Table(name = "wx_rent_contract") | |||
| public class WxRentContract implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -37,15 +39,24 @@ public class WxRentContract implements Serializable { | |||
| public void setIds(List<String> 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 BigDecimal price; | |||
| private Integer merchantId; | |||
| /*月租金/分成(分)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="月租金/分成(分)",name="price") | |||
| private Integer price; | |||
| /*计租开始时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="计租开始时间",name="rentalStartDate") | |||
| private Date rentalStartDate; | |||
| @@ -55,22 +66,68 @@ public class WxRentContract implements Serializable { | |||
| /*签定合同时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="签定合同时间",name="signDate") | |||
| private Date signDate; | |||
| /*计租面积**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="计租面积",name="payArea") | |||
| private BigDecimal payArea; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="receivePeriod") | |||
| /*付款周期**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="付款周期",name="receivePeriod") | |||
| private Integer receivePeriod; | |||
| public Long getMerchantId() { | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private Integer 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="firstPayDate") | |||
| private Date firstPayDate; | |||
| /*交租日 计租开始时间减去交租日的天数为基数 提前多少日交租**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="交租日 计租开始时间减去交租日的天数为基数 提前多少日交租",name="payDate") | |||
| private Date 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 Integer businessId; | |||
| /*店铺类型**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="店铺类型",name="shopType") | |||
| private Integer shopType; | |||
| /*商铺ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") | |||
| private Integer 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="rent_area") | |||
| private String rent_area; | |||
| public Integer getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| public void setMerchantId(Integer _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public BigDecimal getPrice() { | |||
| public Integer getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(BigDecimal _price) { | |||
| public void setPrice(Integer _price) { | |||
| price = _price; | |||
| } | |||
| public Date getRentalStartDate() { | |||
| @@ -91,31 +148,137 @@ public class WxRentContract implements Serializable { | |||
| public void setSignDate(Date _signDate) { | |||
| signDate = _signDate; | |||
| } | |||
| public BigDecimal getPayArea() { | |||
| return payArea; | |||
| } | |||
| public void setPayArea(BigDecimal _payArea) { | |||
| payArea = _payArea; | |||
| } | |||
| public Integer getReceivePeriod() { | |||
| return receivePeriod; | |||
| } | |||
| public void setReceivePeriod(Integer _receivePeriod) { | |||
| receivePeriod = _receivePeriod; | |||
| } | |||
| public Integer getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(Integer _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 Date getFirstPayDate() { | |||
| return firstPayDate; | |||
| } | |||
| public void setFirstPayDate(Date _firstPayDate) { | |||
| firstPayDate = _firstPayDate; | |||
| } | |||
| public Date getPayDate() { | |||
| return payDate; | |||
| } | |||
| public void setPayDate(Date _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 Integer getBusinessId() { | |||
| return businessId; | |||
| } | |||
| public void setBusinessId(Integer _businessId) { | |||
| businessId = _businessId; | |||
| } | |||
| public Integer getShopType() { | |||
| return shopType; | |||
| } | |||
| public void setShopType(Integer _shopType) { | |||
| shopType = _shopType; | |||
| } | |||
| public Integer getShopId() { | |||
| return shopId; | |||
| } | |||
| public void setShopId(Integer _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 static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` 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") | |||
| ,PayArea_ASC("`payArea` ASC"),PayArea_DESC("`payArea` DESC") | |||
| ,ReceivePay_ASC("`receive_period` ASC"),ReceivePay_DESC("`receive_period` 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") | |||
| ,FirstPayDate_ASC("`first_pay_date` ASC"),FirstPayDate_DESC("`first_pay_date` 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){ | |||
| @@ -148,7 +311,7 @@ public class WxRentContract implements Serializable { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns=sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumRentContractStatus { | |||
| WAIT_SIGN(1, "待签约"), | |||
| SIGNED_RENT_UNPAID(2, "已签约未记租"), | |||
| RENT_PAID(3, "计租中"), | |||
| CONTRACT_TERMINATE(4, "提前终止"), | |||
| CONTRACT_END(5, "合同到期"), | |||
| CONTRACT_END_SOON(6, "合同将到期") | |||
| ; | |||
| public static EnumRentContractStatus getEnum(Integer code) { | |||
| for (EnumRentContractStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumRentContractStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -4,12 +4,21 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxRentContractMapper extends CommonMapper<WxRentContract, String> { | |||
| List<WxRentContract> findList(WxRentContract wxRentContract); | |||
| List<Map<String,Object>> queryRentContractData(WxRentContract wxRentContract); | |||
| WxRentContract findObjectByMerchantId(Long id); | |||
| int queryRentContractWaitSignStatus(WxRentContract wxRentContract); | |||
| int queryRentContractEndSoonStatus(WxRentContract wxRentContract); | |||
| int queryRentContractPaidStatus(WxRentContract wxRentContract); | |||
| } | |||
| @@ -17,4 +17,6 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> { | |||
| Map<String, Object> getMerchantShopByShopId(Map<String,Object> params); | |||
| Map<String,Object> queryShopLeftInfo(Map<String,Object> shopparams); | |||
| } | |||
| @@ -1,19 +1,27 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxRentContractService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<WxRentContract> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<Map<String, Object>> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -26,22 +34,20 @@ public interface WxRentContractService { | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxRentContract record); | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxRentContract record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| ResultData deleteById(String id); | |||
| void download(HttpServletRequest request, HttpServletResponse response, String tenantId); | |||
| Object getRentContractStatusInfo(String tenantId); | |||
| } | |||
| @@ -15,8 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| /** | |||
| @@ -191,22 +193,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchant.setCreateDate(date); | |||
| wxMerchantMapper.insertSelective(wxMerchant); | |||
| WxShop wxShopP = new WxShop(); | |||
| wxShopP.setId(wxMerchant.getShopids().get(0)); | |||
| wxShopP = wxShopMapper.findList(wxShopP).get(0); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(merchantid); | |||
| wxRentContract.setRentalStartDate(wxMerchant.getRentalStartDate()); | |||
| wxRentContract.setRentalEndDate(wxMerchant.getRentalEndDate()); | |||
| wxRentContract.setPrice(wxMerchant.getPrice()); | |||
| wxRentContract.setSignDate(date); | |||
| wxRentContract.setPayArea(new BigDecimal(wxShopP.getOperationArea())); | |||
| wxRentContract.setReceivePeriod(wxMerchant.getReceivePeriod()); | |||
| wxRentContractMapper.insertSelective(wxRentContract); | |||
| //buildRent(wxRentContract,wxShopP); | |||
| //保存商户商铺的关联 | |||
| @@ -268,16 +254,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShopP = new WxShop(); | |||
| wxShopP.setId(wxMerchant.getShopids().get(0)); | |||
| wxShopP = wxShopMapper.findList(wxShopP).get(0); | |||
| WxRentContract wxRentContract = wxRentContractMapper.findObjectByMerchantId(wxMerchant.getId()); | |||
| wxRentContract.setRentalStartDate(wxMerchant.getRentalStartDate()); | |||
| wxRentContract.setRentalEndDate(wxMerchant.getRentalEndDate()); | |||
| wxRentContract.setPrice(wxMerchant.getPrice()); | |||
| wxRentContract.setSignDate(date); | |||
| wxRentContract.setPayArea(new BigDecimal(wxShopP.getOperationArea())); | |||
| wxRentContract.setReceivePeriod(wxMerchant.getReceivePeriod()); | |||
| wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | |||
| //删除当前商户关联的所有商铺然后再插入 | |||
| WxMerchantShop wxMerchantShopQuery = new WxMerchantShop(); | |||
| @@ -376,136 +352,136 @@ 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<paycount;i++){ | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(rentalStartDate); | |||
| instance.add(Calendar.MONTH,i); | |||
| rentalStartDate=instance.getTime(); | |||
| 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()); | |||
| wxBillRent.setNeedPay(needpaymoney); | |||
| 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==4){//3 | |||
| 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<paycount;i++) { | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(rentalStartDate); | |||
| instance.add(Calendar.MONTH, i); | |||
| rentalStartDate = instance.getTime(); | |||
| 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()); | |||
| wxBillRent.setNeedPay(needpaymoney); | |||
| 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==12) {//1 | |||
| 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 < paycount; i++) { | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(rentalStartDate); | |||
| instance.add(Calendar.MONTH, i); | |||
| rentalStartDate = instance.getTime(); | |||
| 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()); | |||
| wxBillRent.setNeedPay(needpaymoney); | |||
| 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); | |||
| } | |||
| } | |||
| } | |||
| // 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<paycount;i++){ | |||
| // | |||
| // Calendar instance = Calendar.getInstance(); | |||
| // instance.setTime(rentalStartDate); | |||
| // instance.add(Calendar.MONTH,i); | |||
| // rentalStartDate=instance.getTime(); | |||
| // | |||
| // 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()); | |||
| // wxBillRent.setNeedPay(needpaymoney); | |||
| // 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==4){//3 | |||
| // 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<paycount;i++) { | |||
| // | |||
| // Calendar instance = Calendar.getInstance(); | |||
| // instance.setTime(rentalStartDate); | |||
| // instance.add(Calendar.MONTH, i); | |||
| // rentalStartDate = instance.getTime(); | |||
| // | |||
| // 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()); | |||
| // wxBillRent.setNeedPay(needpaymoney); | |||
| // 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==12) {//1 | |||
| // 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 < paycount; i++) { | |||
| // | |||
| // Calendar instance = Calendar.getInstance(); | |||
| // instance.setTime(rentalStartDate); | |||
| // instance.add(Calendar.MONTH, i); | |||
| // rentalStartDate = instance.getTime(); | |||
| // | |||
| // 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()); | |||
| // wxBillRent.setNeedPay(needpaymoney); | |||
| // 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); | |||
| // } | |||
| // } | |||
| // | |||
| // } | |||
| @@ -2,26 +2,51 @@ 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.WxRentContract; | |||
| import com.iformall.enums.EnumRentContractStatus; | |||
| import com.iformall.enums.EnumShopStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxRentContractMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.WxRentContractService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.FileInputStream; | |||
| import java.io.InputStream; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Service | |||
| public class WxRentContractServiceImpl implements WxRentContractService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @Autowired | |||
| WxRentContractMapper wxRentContractMapper; | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Override | |||
| public PageInfo<WxRentContract> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(record)); | |||
| public PageInfo<Map<String, Object>> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData); | |||
| return pageInfo; | |||
| //return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(record)); | |||
| } | |||
| @Override | |||
| @@ -30,26 +55,97 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxRentContract record) { | |||
| public ResultData saveOrUpdate(WxRentContract record) { | |||
| //保存租赁合同信息 | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxRentContractMapper.insertSelective(record); | |||
| } else { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | |||
| Date date = new Date(); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| try { | |||
| wxRentContractMapper.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 {//更新租赁合同信息 | |||
| record.setUpdatetime(new Date()); | |||
| try { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(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, "更新租赁合同信息成功"); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| public ResultData deleteById(String id) { | |||
| wxRentContractMapper.deleteByPrimaryKey(id); | |||
| return new ResultData(Result.SUCCESS, "删除租赁合同信息成功"); | |||
| } | |||
| @Override | |||
| public void download(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||
| String id = request.getParameter("id"); | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); | |||
| String filename = wxRentContract.getFilepath().substring(wxRentContract.getFilepath().lastIndexOf("/")); | |||
| downFile(wxRentContract.getFilepath(), filename, response, request); | |||
| } | |||
| @Override | |||
| public Object getRentContractStatusInfo(String tenantId) { | |||
| Map<String,Object> resultData=new HashMap(); | |||
| //商铺信息 | |||
| Map<String,Object> shopparams=new HashMap<>(); | |||
| shopparams.put("tenantId",tenantId); | |||
| shopparams.put("status",EnumShopStatus.NOT_RENT.getCode()); | |||
| Map<String,Object> shopLeftInfo=wxShopMapper.queryShopLeftInfo(shopparams); | |||
| resultData.put("shopLeftInfo",shopLeftInfo); | |||
| //待签约 | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setTenantId(Integer.valueOf(tenantId)); | |||
| wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||
| int waitSignCount=wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); | |||
| resultData.put("waitSignCount",waitSignCount); | |||
| //将到期 | |||
| int endSoonCount=wxRentContractMapper.queryRentContractEndSoonStatus(wxRentContract); | |||
| resultData.put("endSoonCount",endSoonCount); | |||
| //计租中 | |||
| int rendPaidCount=wxRentContractMapper.queryRentContractPaidStatus(wxRentContract); | |||
| resultData.put("rendPaidCount",rendPaidCount); | |||
| return resultData; | |||
| } | |||
| 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(); | |||
| } | |||
| } | |||
| } | |||
| @@ -2,49 +2,101 @@ | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxRentContractMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContract"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="price" jdbcType="DECIMAL" property="price" /> | |||
| <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate" /> | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate" /> | |||
| <result column="sign_date" jdbcType="TIMESTAMP" property="signDate" /> | |||
| <result column="pay_area" jdbcType="DECIMAL" property="payArea" /> | |||
| <result column="receive_period" jdbcType="INTEGER" property="receivePeriod" /> | |||
| <id column="id" jdbcType="INTEGER" property="id"/> | |||
| <result column="merchant_id" jdbcType="INTEGER" property="merchantId"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate"/> | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/> | |||
| <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/> | |||
| <result column="receive_period" jdbcType="INTEGER" property="receivePeriod"/> | |||
| <result column="tenant_id" jdbcType="INTEGER" property="tenantId"/> | |||
| <result column="filepath" jdbcType="VARCHAR" property="filepath"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="contract_number" jdbcType="VARCHAR" property="contractNumber"/> | |||
| <result column="deposit" jdbcType="VARCHAR" property="deposit"/> | |||
| <result column="first_pay_date" jdbcType="TIMESTAMP" property="firstPayDate"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/> | |||
| <result column="brand" jdbcType="VARCHAR" property="brand"/> | |||
| <result column="business_id" jdbcType="INTEGER" property="businessId"/> | |||
| <result column="shop_type" jdbcType="INTEGER" property="shopType"/> | |||
| <result column="shop_id" jdbcType="INTEGER" property="shopId"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`pay_area`,`receive_period` | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`first_pay_date`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != price "> and `price` = #{price} </if> | |||
| <if test=" null != rentalStartDate "> and `rental_start_date` = #{rentalStartDate} </if> | |||
| <if test=" null != rentalEndDate "> and `rental_end_date` = #{rentalEndDate} </if> | |||
| <if test=" null != signDate "> and `sign_date` = #{signDate} </if> | |||
| <if test=" null != payArea "> and `pay_area` = #{payArea} </if> | |||
| <if test=" null != receivePeriod "> and `receive_period` = #{receivePeriod} </if> | |||
| where 1 = 1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != price ">and `price` = #{price}</if> | |||
| <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if> | |||
| <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if> | |||
| <if test=" null != signDate ">and `sign_date` = #{signDate}</if> | |||
| <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != filepath ">and `filepath` = #{filepath}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != contractNumber ">and `contract_number` = #{contractNumber}</if> | |||
| <if test=" null != deposit ">and `deposit` = #{deposit}</if> | |||
| <if test=" null != firstPayDate ">and `first_pay_date` = #{firstPayDate}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != merchantName ">and `merchant_name` = #{merchantName}</if> | |||
| <if test=" null != brand ">and `brand` = #{brand}</if> | |||
| <if test=" null != businessId ">and `business_id` = #{businessId}</if> | |||
| <if test=" null != shopType ">and `shop_type` = #{shopType}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxRentContract" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_rent_contract | |||
| <include refid="dynamicWhereConditions" /> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_rent_contract | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findObjectByMerchantId" resultMap="BaseResultMap"> | |||
| select * from wx_rent_contract where merchant_id=#{value} | |||
| <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`, | |||
| rc.price,rc.contract_number,s.shop_number,f.floor_name,b.building_name | |||
| from wx_rent_contract rc | |||
| left join wx_shop s on rc.shop_id=s.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| left join wx_mall_building b on s.building=b.id | |||
| <where> | |||
| <if test=" null != merchantName">and rc.`merchant_name` like concat('%',#{merchantName},'%') </if> | |||
| <if test=" null != shopNumber ">and s.`shop_number` like concat('%',#{shopNumber},'%')</if> | |||
| <if test=" null != status ">and rc.`status` = #{status}</if> | |||
| </where> | |||
| order by id desc | |||
| </select> | |||
| <select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=#{status} | |||
| </select> | |||
| <select id="queryRentContractEndSoonStatus" resultType="int"> | |||
| select count(id) from wx_rent_contract where tenant_id=#{tenantId} and DATEDIFF(rental_end_date,now()) <= 30 | |||
| </select> | |||
| <select id="queryRentContractPaidStatus" resultType="int"> | |||
| select count(id) from wx_rent_contract where rental_start_date <= now() and rental_end_date >= now() | |||
| </select> | |||
| </mapper> | |||
| @@ -239,5 +239,10 @@ | |||
| inner join wx_rent_contract c on ms.merchant_id=c.merchant_id | |||
| where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 | |||
| </select> | |||
| <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select count(id) shopcount,sum(build_area) area from wx_shop | |||
| where tenant_id=#{tenantId} and status=#{status} | |||
| </select> | |||
| </mapper> | |||