| @@ -0,0 +1,73 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import com.iformall.service.WxBillDailyService; | |||
| 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("wxBillDaily") | |||
| public class WxBillDailyController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillDailyService wxBillDailyService; | |||
| 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 WxBillDaily wxBillDaily,Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillDaily) { | |||
| wxBillDaily = new WxBillDaily(); | |||
| } | |||
| wxBillDaily.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String,Object>> page = wxBillDailyService.listAsPage(wxBillDaily, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillDaily wxBillDaily) { | |||
| wxBillDaily.setTenantId(getTenantId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| wxBillDailyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillDailyService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| return wxBillDailyService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,251 @@ | |||
| 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_daily") | |||
| public class WxBillDaily 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="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已结清",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; | |||
| 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 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)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumBillDailyStatus { | |||
| WAIT_PAY(1,"待缴"), | |||
| NOT_PAID(2, "欠缴"), | |||
| PAID(3, "已结清"), | |||
| ; | |||
| public static EnumBillDailyStatus getEnum(Integer code) { | |||
| for (EnumBillDailyStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumBillDailyStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -1,8 +1,10 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumBillRentStatus { | |||
| NOT_EXPIRED(1,"未到期"), | |||
| @@ -0,0 +1,22 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxBillDailyMapper extends CommonMapper<WxBillDaily, String> { | |||
| List<WxBillDaily> findList(WxBillDaily wxBillDaily); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| List<Map<String,Object>> queryBillDailyList(WxBillDaily record); | |||
| } | |||
| @@ -0,0 +1,49 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxBillDailyService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param offset | |||
| * @param limit | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| Map<String, Object> getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxBillDaily record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| ResultData updatePaid(Long id); | |||
| } | |||
| @@ -0,0 +1,153 @@ | |||
| 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.WxBillDaily; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillDailyMapper; | |||
| import com.iformall.service.WxBillDailyService; | |||
| 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.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Service | |||
| public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxBillDailyMapper wxBillDailyMapper; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillDailyMapper.queryBillDailyList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillDaily 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 { | |||
| wxBillDailyMapper.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(WxBillDaily 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 { | |||
| wxBillDailyMapper.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) { | |||
| WxBillDaily record = new WxBillDaily(); | |||
| record.setId(id); | |||
| return wxBillDailyMapper.queryBillDailyList(record).get(0); | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillDaily record) { | |||
| if (record.getId() == null) { | |||
| logger.info("新增日常账单"); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| Date date = new Date(); | |||
| record.setStatus(record.getReceiveDate().before(date)?EnumBillDailyStatus.WAIT_PAY.getCode():EnumBillDailyStatus.NOT_PAID.getCode()); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| try { | |||
| wxBillDailyMapper.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("更新日常押金账单"); | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(record.getId()); | |||
| wxBillDaily.setPayDate(record.getPayDate()); | |||
| wxBillDaily.setPay(record.getPay() * 100); | |||
| wxBillDaily.setReceivePay(record.getReceivePay() * 100); | |||
| wxBillDaily.setOwe(record.getOwe() * 100); | |||
| wxBillDaily.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillDaily.getStatus()); | |||
| wxBillDaily.setUpdatetime(new Date()); | |||
| try { | |||
| wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); | |||
| } 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) { | |||
| wxBillDailyMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(id); | |||
| wxBillDaily.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| wxBillDaily.setPayDate(d); | |||
| wxBillDaily.setUpdatetime(d); | |||
| try { | |||
| wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); | |||
| } catch (Exception e) { | |||
| logger.error("日常账单结单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(),e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "日常账单结单成功"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,89 @@ | |||
| <?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.WxBillDailyMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillDaily"> | |||
| <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" /> | |||
| </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` | |||
| </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 != 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.WxBillDaily" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_daily | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="queryBillDailyList" parameterType="com.iformall.domain.po.WxBillDaily" 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`, | |||
| br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`, | |||
| br.`merchant_id` merchantId | |||
| from wx_bill_daily br left join wx_merchant m on br.merchant_id=m.id | |||
| left join wx_shop s on br.shop_id=s.id | |||
| <where> | |||
| <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> | |||
| </where> | |||
| order by id | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_daily 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_daily set status=#{waitPay} where tenant_id=#{tenantId} | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| </mapper> | |||