| @@ -0,0 +1,80 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||||
| import com.iformall.service.WxBillOtherDepositService; | |||||
| 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("wxBillOtherDeposit") | |||||
| public class WxBillOtherDepositController extends BaseController { | |||||
| @Autowired | |||||
| private WxBillOtherDepositService wxBillOtherDepositService; | |||||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @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 WxBillOtherDeposit wxBillOtherDeposit, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::list"); | |||||
| if (null == wxBillOtherDeposit) { | |||||
| wxBillOtherDeposit = new WxBillOtherDeposit(); | |||||
| } | |||||
| wxBillOtherDeposit.setTenantId(getTenantId()); | |||||
| final PageInfo<Map<String, Object>> page = wxBillOtherDepositService.listAsPage(wxBillOtherDeposit, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::add"); | |||||
| wxBillOtherDeposit.setTenantId(getTenantId()); | |||||
| wxBillOtherDeposit.setUserId(getUser().getId()); | |||||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit); | |||||
| } | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::update"); | |||||
| wxBillOtherDeposit.setUserId(getUser().getId()); | |||||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit); | |||||
| } | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::delete"); | |||||
| wxBillOtherDepositService.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) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillOtherDepositService.getById(id)); | |||||
| } | |||||
| @GetMapping("/updatePaid") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData updatePaid(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::updatePaid"); | |||||
| return wxBillOtherDepositService.updatePaid(id); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,299 @@ | |||||
| 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_bill_other_deposit") | |||||
| public class WxBillOtherDeposit implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> 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<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| @Transient | |||||
| private String merchantName; | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单名称", name = "name") | |||||
| private String name; | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单备注", name = "comments") | |||||
| private String comments; | |||||
| public String getComments() { | |||||
| return comments; | |||||
| } | |||||
| public void setComments(String comments) { | |||||
| this.comments = comments; | |||||
| } | |||||
| /*实际应收金额**/ | |||||
| @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已结清**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单状态1未到期2待缴3欠缴4已结清5已退还", name = "status") | |||||
| private Integer status; | |||||
| /*删除 是1否0**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "删除 是1否0", name = "isDel") | |||||
| private Integer isDel; | |||||
| /*商户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; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | |||||
| private Integer rentShopType; | |||||
| 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 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 Integer getRentShopType() { | |||||
| return rentShopType; | |||||
| } | |||||
| public void setRentShopType(Integer rentShopType) { | |||||
| this.rentShopType = rentShopType; | |||||
| } | |||||
| public static enum Field { | |||||
| Id_ASC("`id` ASC"), Id_DESC("`id` 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"), 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<Field> 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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -50,6 +50,9 @@ public class WxBillAll { | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | @io.swagger.annotations.ApiModelProperty(value="id",name="id") | ||||
| private Long id; | private Long id; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁店铺类型", name = "rentShopType") | |||||
| private Integer rentShopType; | |||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -161,4 +164,12 @@ public class WxBillAll { | |||||
| public void setMonth(String month) { | public void setMonth(String month) { | ||||
| this.month = month; | this.month = month; | ||||
| } | } | ||||
| public Integer getRentShopType() { | |||||
| return rentShopType; | |||||
| } | |||||
| public void setRentShopType(Integer rentShopType) { | |||||
| this.rentShopType = rentShopType; | |||||
| } | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ public enum EnumBillRentStatus { | |||||
| WAIT_PAY(2,"待缴"), | WAIT_PAY(2,"待缴"), | ||||
| PAID(3, "已结清"), | PAID(3, "已结清"), | ||||
| NOT_EXPIRED(4,"未到期"), | NOT_EXPIRED(4,"未到期"), | ||||
| RETURN(5, "已退还"), | |||||
| ; | ; | ||||
| public static EnumBillRentStatus getEnum(Integer code) { | public static EnumBillRentStatus getEnum(Integer code) { | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumRentShopType { | |||||
| SHOP(1, "店铺"), | |||||
| POINT(2, "点位"),; | |||||
| public static EnumRentShopType getEnum(Integer code) { | |||||
| for (EnumRentShopType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumRentShopType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -10,7 +10,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillAllMapper extends CommonMapper<MallPermission, String> { | |||||
| public interface WxBillAllMapper extends CommonMapper<MallPermission, Long> { | |||||
| List<Map<String,Object>> list(WxBillAll record); | List<Map<String,Object>> list(WxBillAll record); | ||||
| @@ -9,7 +9,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillDailyMapper extends CommonMapper<WxBillDaily, String> { | |||||
| public interface WxBillDailyMapper extends CommonMapper<WxBillDaily, Long> { | |||||
| List<WxBillDaily> findList(WxBillDaily wxBillDaily); | List<WxBillDaily> findList(WxBillDaily wxBillDaily); | ||||
| @@ -10,7 +10,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillDepositMapper extends CommonMapper<WxBillDeposit, String> { | |||||
| public interface WxBillDepositMapper extends CommonMapper<WxBillDeposit, Long> { | |||||
| List<WxBillDeposit> findList(WxBillDeposit wxBillDeposit); | List<WxBillDeposit> findList(WxBillDeposit wxBillDeposit); | ||||
| @@ -0,0 +1,22 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxBillOtherDepositMapper extends CommonMapper<WxBillOtherDeposit, Long> { | |||||
| List<WxBillOtherDeposit> findList(WxBillOtherDeposit record); | |||||
| void updateNotPaidStatus(Map<String, Object> params); | |||||
| void updateWaitPayStatus(Map<String, Object> params); | |||||
| List<Map<String, Object>> queryBillList(WxBillOtherDeposit record); | |||||
| } | |||||
| @@ -9,7 +9,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillOtherMapper extends CommonMapper<WxBillOther, String> { | |||||
| public interface WxBillOtherMapper extends CommonMapper<WxBillOther, Long> { | |||||
| List<WxBillOther> findList(WxBillOther wxBillDaily); | List<WxBillOther> findList(WxBillOther wxBillDaily); | ||||
| @@ -9,7 +9,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillPropertyDepositMapper extends CommonMapper<WxBillPropertyDeposit, String> { | |||||
| public interface WxBillPropertyDepositMapper extends CommonMapper<WxBillPropertyDeposit, Long> { | |||||
| List<WxBillPropertyDeposit> findList(WxBillPropertyDeposit wxBillPropertyDeposit); | List<WxBillPropertyDeposit> findList(WxBillPropertyDeposit wxBillPropertyDeposit); | ||||
| @@ -9,7 +9,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, String> { | |||||
| public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long> { | |||||
| List<WxBillProperty> findList(WxBillProperty wxBillProperty); | List<WxBillProperty> findList(WxBillProperty wxBillProperty); | ||||
| @@ -9,7 +9,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public interface WxBillRentMapper extends CommonMapper<WxBillRent, String> { | |||||
| public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> { | |||||
| List<WxBillRent> findList(WxBillRent wxBillRent); | List<WxBillRent> findList(WxBillRent wxBillRent); | ||||
| @@ -0,0 +1,52 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxBillOther; | |||||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxBillOtherDepositService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| PageInfo<Map<String, Object>> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize); | |||||
| void updateBillStatus(WxBillOtherDeposit record); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| Map<String, Object> getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(WxBillOtherDeposit record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| ResultData updatePaid(Long id); | |||||
| } | |||||
| @@ -6,10 +6,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.enums.EnumBillDailyStatus; | |||||
| import com.iformall.enums.EnumBillRentStatus; | |||||
| import com.iformall.enums.EnumBillType; | |||||
| import com.iformall.enums.EnumBillTypeParam; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| @@ -497,13 +494,23 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| WxBillAll record = new WxBillAll(); | WxBillAll record = new WxBillAll(); | ||||
| record.setTenantId(tenantId); | record.setTenantId(tenantId); | ||||
| record.setMonth(month); | record.setMonth(month); | ||||
| record.setRentShopType(EnumRentShopType.SHOP.getCode()); | |||||
| record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | ||||
| Map<String, Object> oweInfo = wxBillAllMapper.queryOweInfo(record); | |||||
| Map<String, Object> oweInfoForShop = wxBillAllMapper.queryOweInfo(record); | |||||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | record.setStatus(EnumBillRentStatus.PAID.getCode()); | ||||
| Map<String, Object> paidInfo = wxBillAllMapper.queryPaidInfo(record); | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| result.putAll(oweInfo); | |||||
| result.putAll(paidInfo); | |||||
| Map<String, Object> paidInfoForShop = wxBillAllMapper.queryPaidInfo(record); | |||||
| record.setRentShopType(EnumRentShopType.POINT.getCode()); | |||||
| record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| Map<String, Object> oweInfoForPoint = wxBillAllMapper.queryOweInfo(record); | |||||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| Map<String, Object> paidInfoForPoint = wxBillAllMapper.queryPaidInfo(record); | |||||
| Map<String, Object> result = new HashMap<>(5); | |||||
| result.put("oweInfoForShop", oweInfoForShop); | |||||
| result.put("paidInfoForShop", paidInfoForShop); | |||||
| result.put("oweInfoForPoint", oweInfoForPoint); | |||||
| result.put("paidInfoForPoint", paidInfoForPoint); | |||||
| return result; | return result; | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,185 @@ | |||||
| 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.WxBillOther; | |||||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||||
| import com.iformall.domain.po.WxShop; | |||||
| import com.iformall.enums.EnumBillDailyStatus; | |||||
| import com.iformall.enums.EnumBillRentStatus; | |||||
| import com.iformall.enums.EnumDelStatus; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxBillOtherDepositMapper; | |||||
| import com.iformall.mapper.WxShopMapper; | |||||
| import com.iformall.service.WxBillOtherDepositService; | |||||
| 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 WxBillOtherDepositServiceImpl implements WxBillOtherDepositService { | |||||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxBillOtherDepositMapper wxBillOtherDepositMapper; | |||||
| @Autowired | |||||
| WxShopMapper wxShopMapper; | |||||
| @Override | |||||
| public PageInfo<Map<String, Object>> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize) { | |||||
| //更新账单状态 | |||||
| updateBillStatus(record); | |||||
| //分页对象设置页数和条数 | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| //查询 | |||||
| List<Map<String, Object>> billList = wxBillOtherDepositMapper.queryBillList(record); | |||||
| //结果放入分页对象 | |||||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billList); | |||||
| return pageInfo; | |||||
| } | |||||
| @Override | |||||
| public void updateBillStatus(WxBillOtherDeposit record) { | |||||
| logger.info("更新其他押金账单状态开始..."); | |||||
| //更新逾期天数及状态 | |||||
| updateNotPaidStatus(record); | |||||
| //更新待缴的状态 | |||||
| updateWaidPayStatus(record); | |||||
| logger.info("更新其他押金账单状态结束..."); | |||||
| } | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public void updateWaidPayStatus(WxBillOtherDeposit record) { | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", record.getTenantId()); | |||||
| params.put("waitPay", EnumBillDailyStatus.WAIT_PAY.getCode()); | |||||
| params.put("paid", EnumBillRentStatus.PAID.getCode()); | |||||
| try { | |||||
| wxBillOtherDepositMapper.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(WxBillOtherDeposit record) { | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", record.getTenantId()); | |||||
| params.put("notPaid", EnumBillDailyStatus.NOT_PAID.getCode()); | |||||
| params.put("paid", EnumBillRentStatus.PAID.getCode()); | |||||
| try { | |||||
| wxBillOtherDepositMapper.updateNotPaidStatus(params); | |||||
| } catch (Exception e) { | |||||
| logger.error("更新其他欠缴账单状态失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public Map<String, Object> getById(Long id) { | |||||
| WxBillOtherDeposit record = new WxBillOtherDeposit(); | |||||
| record.setId(id); | |||||
| Map<String, Object> wxBillOther = wxBillOtherDepositMapper.queryBillList(record).get(0); | |||||
| if (wxBillOther.get("shopId") != null) { | |||||
| WxShop shop = new WxShop(); | |||||
| shop.setId((Long) wxBillOther.get("shopId")); | |||||
| List<Map<String, Object>> shoplist = wxShopMapper.findListMap(shop); | |||||
| wxBillOther.put("shops", shoplist); | |||||
| } else { | |||||
| wxBillOther.put("shops", Collections.EMPTY_LIST); | |||||
| } | |||||
| return wxBillOther; | |||||
| } | |||||
| @Override | |||||
| public ResultData saveOrUpdate(WxBillOtherDeposit record) { | |||||
| int receivepay = record.getReceivePay().intValue(); | |||||
| int pay = record.getPay().intValue(); | |||||
| if (pay > receivepay) { | |||||
| return new ResultData(ErrorCode.BILL_PAY_ERROR, "实收金额不能大于实际应收金额"); | |||||
| } | |||||
| if (record.getId() == null) { | |||||
| logger.info("新增其他账单"); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| Date date = new Date(); | |||||
| record.setStatus(record.getReceiveDate().after(date) ? EnumBillDailyStatus.WAIT_PAY.getCode() : EnumBillDailyStatus.NOT_PAID.getCode()); | |||||
| record.setCreatetime(date); | |||||
| record.setUpdatetime(date); | |||||
| record.setExpiredDay(0L); | |||||
| record.setOwe(record.getReceivePay() - record.getPay()); | |||||
| record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||||
| try { | |||||
| wxBillOtherDepositMapper.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("更新其他押金账单"); | |||||
| WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectByPrimaryKey(record.getId()); | |||||
| if (wxBillOtherDeposit == null) { | |||||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||||
| } | |||||
| wxBillOtherDeposit.setPayDate(record.getPayDate()); | |||||
| wxBillOtherDeposit.setPay(record.getPay()); | |||||
| wxBillOtherDeposit.setReceivePay(record.getReceivePay()); | |||||
| wxBillOtherDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||||
| wxBillOtherDeposit.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillOtherDeposit.getStatus()); | |||||
| wxBillOtherDeposit.setUpdatetime(new Date()); | |||||
| try { | |||||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); | |||||
| } 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) { | |||||
| wxBillOtherDepositMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| @Override | |||||
| public ResultData updatePaid(Long id) { | |||||
| WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectByPrimaryKey(id); | |||||
| if (wxBillOtherDeposit == null) { | |||||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||||
| } | |||||
| wxBillOtherDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||||
| Date d = new Date(); | |||||
| wxBillOtherDeposit.setPayDate(d); | |||||
| wxBillOtherDeposit.setUpdatetime(d); | |||||
| try { | |||||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); | |||||
| } catch (Exception e) { | |||||
| logger.error("其他押金账单结单失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "其他押金账单结单成功"); | |||||
| } | |||||
| } | |||||
| @@ -5,20 +5,36 @@ | |||||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||
| select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | ||||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | ||||
| bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,s.manager,s.manager_phone managerPhone from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=2 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_other | |||||
| bill.tenant_id tenantId,m.name merchantName,s.shop_number | |||||
| shopNumber,bill.starttime,bill.endtime,bill.name,s.manager,s.manager_phone managerPhone, | |||||
| bill.rent_shop_type rentShopType from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | |||||
| endtime,rent_shop_type from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | |||||
| endtime,rent_shop_type from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | |||||
| endtime,rent_shop_type from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | |||||
| endtime,rent_shop_type from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||||
| from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||||
| from wx_bill_daily where type=2 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||||
| from wx_bill_other | |||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| left join wx_shop s on bill.shop_id=s.id | left join wx_shop s on bill.shop_id=s.id | ||||
| @@ -29,6 +45,8 @@ | |||||
| <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if> | <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if> | ||||
| <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if> | <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if> | ||||
| <if test=" null != status ">and bill.`status` = #{status}</if> | <if test=" null != status ">and bill.`status` = #{status}</if> | ||||
| <if test=" null != rentShopType ">and bill.rent_shop_type = #{rentShopType}</if> | |||||
| order by bill.id desc,bill.merchant_id,bill.status,bill.receive_date desc | order by bill.id desc,bill.merchant_id,bill.status,bill.receive_date desc | ||||
| </select> | </select> | ||||
| @@ -38,19 +56,31 @@ | |||||
| select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from ( | select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from ( | ||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent | |||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit | |||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_rent_deposit | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property | |||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_property | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit | |||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_property_deposit | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1 | |||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=1 | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2 | |||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=2 | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_other | |||||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other | |||||
| ) bill | ) bill | ||||
| where bill.tenant_id=#{tenantId} and bill.status=#{status} | where bill.tenant_id=#{tenantId} and bill.status=#{status} | ||||
| <if test=" null != starttime and null!= endtime "> | <if test=" null != starttime and null!= endtime "> | ||||
| @@ -59,25 +89,39 @@ | |||||
| <if test=" null != month "> | <if test=" null != month "> | ||||
| and date_format(bill.receive_date,'%Y-%m')=#{month} | and date_format(bill.receive_date,'%Y-%m')=#{month} | ||||
| </if> | </if> | ||||
| <if test=" null != rentShopType "> | |||||
| and bill.rent_shop_type = #{rentShopType} | |||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||
| select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from ( | select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from ( | ||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent | |||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit | |||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_rent_deposit | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property | |||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_property | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit | |||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_property_deposit | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1 | |||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=1 | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2 | |||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=2 | |||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_other | |||||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other | |||||
| ) bill | ) bill | ||||
| where bill.tenant_id=#{tenantId} and bill.status=#{status} | where bill.tenant_id=#{tenantId} and bill.status=#{status} | ||||
| <if test=" null != starttime and null!= endtime "> | <if test=" null != starttime and null!= endtime "> | ||||
| @@ -86,7 +130,9 @@ | |||||
| <if test=" null != month "> | <if test=" null != month "> | ||||
| and date_format(bill.receive_date,'%Y-%m')=#{month} | and date_format(bill.receive_date,'%Y-%m')=#{month} | ||||
| </if> | </if> | ||||
| <if test=" null != rentShopType "> | |||||
| and bill.rent_shop_type = #{rentShopType} | |||||
| </if> | |||||
| </select> | </select> | ||||
| @@ -94,20 +140,35 @@ | |||||
| select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | ||||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | ||||
| bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus, | bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus, | ||||
| pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type, 0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=2 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_other | |||||
| pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount,bill.rent_shop_type | |||||
| rentShopType from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type | |||||
| from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type | |||||
| from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type | |||||
| from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type | |||||
| from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type, 0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||||
| from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||||
| from wx_bill_daily where type=2 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||||
| from wx_bill_other | |||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| left join wx_shop s on bill.shop_id=s.id | left join wx_shop s on bill.shop_id=s.id | ||||
| @@ -144,6 +205,9 @@ | |||||
| <if test=" null != billTypeValue "> | <if test=" null != billTypeValue "> | ||||
| and bill.bill_type_value=#{billTypeValue} | and bill.bill_type_value=#{billTypeValue} | ||||
| </if> | </if> | ||||
| <if test=" null != rentShopType "> | |||||
| and bill.rent_shop_type = #{rentShopType} | |||||
| </if> | |||||
| order by bill.merchant_id,bill.status,bill.receive_date desc | order by bill.merchant_id,bill.status,bill.receive_date desc | ||||
| </select> | </select> | ||||
| @@ -0,0 +1,101 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxBillOtherDepositMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillOtherDeposit"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="receive_pay" jdbcType="INTEGER" property="receivePay"/> | |||||
| <result column="pay" jdbcType="INTEGER" property="pay"/> | |||||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="owe" jdbcType="INTEGER" property="owe"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | |||||
| `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | |||||
| `rent_shop_type` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id ">and `id` = #{id}</if> | |||||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||||
| <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if> | |||||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||||
| <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if> | |||||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||||
| <if test=" null != owe ">and `owe` = #{owe}</if> | |||||
| <if test=" null != status ">and `status` = #{status}</if> | |||||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||||
| <if test=" null != userId ">and `user_id` = #{userId}</if> | |||||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||||
| <if test=" null != name ">and `name` = #{name}</if> | |||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_bill_other_deposit | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultType="hashmap"> | |||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | |||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | |||||
| m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | |||||
| br.`merchant_id` merchantId,br.shop_id shopId,br.name,br.comments,br.`rent_shop_type` rentShopType | |||||
| from wx_bill_other_deposit br left join wx_merchant m on br.merchant_id=m.id | |||||
| left join wx_shop s on br.shop_id=s.id | |||||
| <where> | |||||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||||
| <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%') | |||||
| </if> | |||||
| <if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if> | |||||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||||
| <if test=" null != name ">and br.`name` = #{name}</if> | |||||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||||
| </where> | |||||
| order by id desc | |||||
| </select> | |||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||||
| update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||||
| where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0 | |||||
| </update> | |||||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||||
| update wx_bill_other_deposit set status=#{waitPay} where tenant_id=#{tenantId} | |||||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||||
| </update> | |||||
| </mapper> | |||||