| @@ -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.WxBillOther; | |||
| import com.iformall.service.WxBillOtherService; | |||
| 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("wxBillOther") | |||
| public class WxBillOtherController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillOtherService wxBillOtherService; | |||
| 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 WxBillOther wxBillOther,Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillOther) { | |||
| wxBillOther = new WxBillOther(); | |||
| } | |||
| wxBillOther.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String,Object>> page = wxBillOtherService.listAsPage(wxBillOther, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillOther wxBillOther) { | |||
| wxBillOther.setTenantId(getTenantId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| wxBillOtherService.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,"查询成功",wxBillOtherService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| return wxBillOtherService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,273 @@ | |||
| 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") | |||
| public class WxBillOther 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已结清",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,22 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxBillOtherMapper extends CommonMapper<WxBillOther, String> { | |||
| List<WxBillOther> findList(WxBillOther wxBillDaily); | |||
| void updateNotPaidStatus(Map<String, Object> params); | |||
| void updateWaitPayStatus(Map<String, Object> params); | |||
| List<Map<String,Object>> queryBillDailyList(WxBillOther record); | |||
| } | |||
| @@ -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.WxBillOther; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxBillOtherService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param offset | |||
| * @param limit | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize); | |||
| void updateBillStatus(WxBillOther record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| Map<String, Object> getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxBillOther record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| ResultData updatePaid(Long id); | |||
| } | |||
| @@ -0,0 +1,180 @@ | |||
| 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.WxShop; | |||
| import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillOtherMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.WxBillOtherService; | |||
| 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 WxBillOtherServiceImpl implements WxBillOtherService { | |||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxBillOtherMapper wxBillOtherMapper; | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| //分页对象设置页数和条数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| //查询 | |||
| List<Map<String, Object>> billDepositList = wxBillOtherMapper.queryBillDailyList(record); | |||
| //结果放入分页对象 | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillOther record) { | |||
| logger.info("更新其他账单状态开始..."); | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| logger.info("更新其他账单状态结束..."); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillOther 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 { | |||
| wxBillOtherMapper.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(WxBillOther 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 { | |||
| wxBillOtherMapper.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) { | |||
| WxBillOther record = new WxBillOther(); | |||
| record.setId(id); | |||
| Map<String, Object> wxBillOther = wxBillOtherMapper.queryBillDailyList(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(WxBillOther 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 { | |||
| wxBillOtherMapper.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("更新其他押金账单"); | |||
| WxBillOther wxBillOther = wxBillOtherMapper.selectByPrimaryKey(record.getId()); | |||
| if(wxBillOther==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| wxBillOther.setPayDate(record.getPayDate()); | |||
| wxBillOther.setPay(record.getPay()); | |||
| wxBillOther.setReceivePay(record.getReceivePay()); | |||
| wxBillOther.setOwe(record.getOwe()); | |||
| wxBillOther.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillOther.getStatus()); | |||
| wxBillOther.setUpdatetime(new Date()); | |||
| try { | |||
| wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); | |||
| } 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) { | |||
| wxBillOtherMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillOther wxBillOther = wxBillOtherMapper.selectByPrimaryKey(id); | |||
| if(wxBillOther==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| wxBillOther.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| wxBillOther.setPayDate(d); | |||
| wxBillOther.setUpdatetime(d); | |||
| try { | |||
| wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); | |||
| } 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,95 @@ | |||
| <?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.WxBillOtherMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillOther"> | |||
| <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" /> | |||
| </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` | |||
| </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 != 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.WxBillOther" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_other | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="queryBillDailyList" parameterType="com.iformall.domain.po.WxBillOther" 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 | |||
| from wx_bill_other 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> | |||
| </where> | |||
| order by id | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_other 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 set status=#{waitPay} where tenant_id=#{tenantId} | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| </mapper> | |||