| @@ -1009,3 +1009,23 @@ UPDATE wx_batch_order_97 bo, wx_order_97 o SET bo.order_type=o.compose_order_ty | |||
| UPDATE wx_batch_order_98 bo, wx_order_98 o SET bo.order_type=o.compose_order_type WHERE bo.id = o.compose_order_id; | |||
| UPDATE wx_batch_order_99 bo, wx_order_99 o SET bo.order_type=o.compose_order_type WHERE bo.id = o.compose_order_id; | |||
| ALTER TABLE `wx_bill_settle` ADD COLUMN `has_recorded` int(1) NOT NULL DEFAULT 0 COMMENT '是否已经被统计 1:已经被统计' ; | |||
| CREATE TABLE `wx_bill_settle_schedule` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `settle_number` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '结算单号', | |||
| `merchant_id` bigint(20) DEFAULT NULL COMMENT '商户ID', | |||
| `status` smallint(1) DEFAULT '0' COMMENT '7待清算3结算完成', | |||
| `apply_status` smallint(1) DEFAULT '0' COMMENT '审核状态0未审核1审核中2审核完成3驳回4异常终止5撤回', | |||
| `receive_money` bigint(12) DEFAULT '0' COMMENT '收款', | |||
| `pay_money` bigint(12) DEFAULT '0' COMMENT '承付', | |||
| `settletime` datetime DEFAULT NULL COMMENT '结算时间', | |||
| `createtime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |||
| `updatetime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', | |||
| `settle_receive_pay` bigint(12) NOT NULL DEFAULT '0' COMMENT '结算收款,定时统计', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='结算单'; | |||
| @@ -38,26 +38,26 @@ public class WxBillController extends BaseController { | |||
| @Autowired | |||
| WxBillSettleService wxBillSettleService; | |||
| @ApiOperation("所有欠缴和待缴的数据") | |||
| @PostMapping("listBillOweAndWaitPay") | |||
| public ResultData listBillOweAndWaitPay(@RequestBody WxBillAll wxBillAll) { | |||
| if(StringUtils.isEmpty(wxBillAll.getTenantId())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId不能为空"); | |||
| } | |||
| if(wxBillAll.getMerchantId()==null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId不能为空"); | |||
| } | |||
| WxMerchant wxMerchant = wxMerchantService.getById(wxBillAll.getMerchantId()); | |||
| if(wxMerchant==null){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| if(wxMerchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||
| } | |||
| List<Map<String,Object>> result=wxBillAllService.listBillOweAndWaitPay(wxBillAll); | |||
| return new ResultData(result); | |||
| } | |||
| // @ApiOperation("所有欠缴和待缴的数据") | |||
| // @PostMapping("listBillOweAndWaitPay") | |||
| // public ResultData listBillOweAndWaitPay(@RequestBody WxBillAll wxBillAll) { | |||
| // | |||
| // if(StringUtils.isEmpty(wxBillAll.getTenantId())){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId不能为空"); | |||
| // } | |||
| // if(wxBillAll.getMerchantId()==null){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId不能为空"); | |||
| // } | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(wxBillAll.getMerchantId()); | |||
| // if(wxMerchant==null){ | |||
| // return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| // } | |||
| // if(wxMerchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())){ | |||
| // return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||
| // } | |||
| // List<Map<String,Object>> result=wxBillAllService.listBillOweAndWaitPay(wxBillAll); | |||
| // return new ResultData(result); | |||
| // } | |||
| @ApiOperation("账单") | |||
| @PostMapping("listBill") | |||
| @@ -69,6 +69,9 @@ public class WxBillController extends BaseController { | |||
| if(wxBillAll.getMerchantId()==null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId不能为空"); | |||
| } | |||
| if(wxBillAll.getBillTypeValue()==null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"billTypeValue不能为空"); | |||
| } | |||
| WxMerchant wxMerchant = wxMerchantService.getById(wxBillAll.getMerchantId()); | |||
| if(wxMerchant==null){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| @@ -84,7 +87,7 @@ public class WxBillController extends BaseController { | |||
| logger.info("开始时间和结束时间要同时存在或不存在"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"starttime和endtime要同时存在或不存在"); | |||
| } | |||
| return wxBillAllService.listBill(wxBillAll); | |||
| return wxBillAllService.listBill(wxBillAll,wxMerchant); | |||
| } | |||
| @@ -0,0 +1,50 @@ | |||
| package com.iformall.schedule; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.mapper.WxBillAllMapper; | |||
| import com.iformall.service.WxBillAllService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.scheduling.annotation.Async; | |||
| import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.List; | |||
| @Component | |||
| public class BillSchedule { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxBillAllMapper wxBillAllMapper; | |||
| @Autowired | |||
| WxBillAllService wxBillAllService; | |||
| /** | |||
| * 每天1点执行 | |||
| * 结算账单 | |||
| */ | |||
| @Async | |||
| @Scheduled(cron = "0 0 1 * * ?") | |||
| public void settleBill() { | |||
| WxBillAll wxBillAll = new WxBillAll(); | |||
| //wxBillAll.updateTenantInfo(wxBillAll); | |||
| List<Long> settleBillIdList = wxBillAllMapper.listToSettleBillIdList(wxBillAll); | |||
| if (null != settleBillIdList && settleBillIdList.size() > 0 ) { | |||
| for (int i = 0 ; i < settleBillIdList.size(); i ++) { | |||
| Long settleId = settleBillIdList.get(i); | |||
| try { | |||
| Double pay = wxBillAllService.calcuteSettleBillReceivePay(settleId); | |||
| wxBillAllService.createBillSettleSchedule(settleId, pay); | |||
| }catch(Exception e) { | |||
| logger.error("settleBill error.",e); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -22,7 +22,13 @@ import java.util.Map; | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxBillDaily extends TenantEntity { | |||
| protected Long id; | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 5004263718907992977L; | |||
| protected Long id; | |||
| @TableField(exist = false) | |||
| @@ -23,7 +23,12 @@ import java.util.Map; | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxBillOther extends TenantEntity { | |||
| protected Long id; | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -5919107280859407195L; | |||
| protected Long id; | |||
| @Excel(name = "商户名称", width = 20, orderNum = "2") | |||
| @TableField(exist = false) | |||
| @@ -21,7 +21,12 @@ import java.util.Date; | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxBillProperty extends TenantEntity { | |||
| protected Long id; | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -4019665043805504986L; | |||
| protected Long id; | |||
| @Excel(name = "商户名称", width = 20, orderNum = "2") | |||
| @TableField(exist = false) | |||
| @@ -20,7 +20,12 @@ import java.util.Map; | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxBillSettle extends TenantEntity { | |||
| protected Long id; | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 4737561313157612702L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="结算单号",name="settleNumber") | |||
| @Excel(name="结算单号",width = 20,orderNum = "1") | |||
| @@ -51,6 +56,9 @@ public class WxBillSettle extends TenantEntity { | |||
| private Date createtime; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | |||
| private Date updatetime; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否已经统计,EnumHasRecorded.class",name="hasRecorded") | |||
| private Integer hasRecorded; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||
| @@ -0,0 +1,66 @@ | |||
| package com.iformall.domain.po; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.common.SortColumn; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @TableName(value = "wx_bill_settle_schedule") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxBillSettleSchedule extends TenantEntity { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -5919107280859407195L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="结算单号",name="settleNumber") | |||
| @Excel(name="结算单号",width = 20,orderNum = "1") | |||
| private String settleNumber; | |||
| @TableField(exist = false) | |||
| @Excel(name="结算商户",width = 20,orderNum = "2") | |||
| private String merchantName; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private Long merchantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="0待确认1未清算结余金额2结算完成",name="status") | |||
| @Excel(name="结算状态",width = 20,orderNum = "8") | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核状态0未审核1审核中2审核完成3驳回4异常终止5撤回",name="applyStatus") | |||
| @Excel(name="审批状态",width = 20,orderNum = "9") | |||
| private Integer applyStatus; | |||
| @Excel(name="收款(元)",width = 20,orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="收款",name="receiveMoney") | |||
| private Long receiveMoney; | |||
| @io.swagger.annotations.ApiModelProperty(value="承付",name="payMoney") | |||
| @Excel(name="承付(元)",width = 20,orderNum = "5") | |||
| private Long payMoney; | |||
| @io.swagger.annotations.ApiModelProperty(value="结算时间",name="settletime") | |||
| @Excel(name="结算时间",width = 20,orderNum = "7") | |||
| private Date settletime; | |||
| @Excel(name="创建时间",width = 20,orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | |||
| private Date createtime; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | |||
| private Date updatetime; | |||
| @io.swagger.annotations.ApiModelProperty(value="结算收款,定时统计",name="settleReceivePay") | |||
| private Long settleReceivePay; | |||
| } | |||
| @@ -19,7 +19,12 @@ import java.util.List; | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxMerchantSubsidy extends TenantEntity { | |||
| protected Long id; | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -2906255307445909293L; | |||
| protected Long id; | |||
| @TableField(exist = false) | |||
| protected String idStr; | |||
| @@ -0,0 +1,44 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumBillQueryType { | |||
| RENT(1,"租金"), | |||
| RENT_DEPOSIT(2,"租赁押金"), | |||
| PROPERTY(3,"物业"), | |||
| PROPERTY_DEPOSIT(4, "物业押金"), | |||
| WATER_POWER_AIR(5, "水电空调费"), | |||
| OTHER(7, "其他"), | |||
| OTHER_DEPOSIT(8, "其他押金"), | |||
| SETTLE(10, "结算单") | |||
| ; | |||
| public static EnumBillQueryType getEnum(Integer code) { | |||
| for (EnumBillQueryType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumBillQueryType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,34 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumHasRecorded { | |||
| YES(1, "已经被统计"), | |||
| NO(0, "未被统计"); | |||
| public static EnumHasRecorded getEnum(Integer code) { | |||
| for (EnumHasRecorded value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumHasRecorded(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -1,11 +1,18 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchantSubsidy; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillAllVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.apache.ibatis.annotations.Param; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -18,8 +25,17 @@ public interface WxBillAllMapper { | |||
| Map<String,Object> queryPaidInfo(WxBillAll record); | |||
| List<Map<String,Object>> listData(WxBillAll wxBillAll); | |||
| //List<Map<String,Object>> listData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listRentBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listRentDepositBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listPropertyBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listPropertyDepositBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listDailyBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listOtherBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listOtherDepositBillData(WxBillAll wxBillAll); | |||
| List<Map<String,Object>> listSettleBillData(WxBillAll wxBillAll); | |||
| List<Map<String, Object>> getWaitPayBill(); | |||
| List<Map<String, Object>> getOweBill(); | |||
| @@ -4,6 +4,8 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillSettle; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| /** | |||
| * @author luozukai | |||
| */ | |||
| @@ -13,6 +15,8 @@ public interface WxBillSettleMapper extends CommonMapper<WxBillSettle, Long> { | |||
| void update(WxBillSettle record); | |||
| void updateRecorded(@Param("id")Long id); | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxBillSettleSchedule; | |||
| import com.iformall.domain.po.WxMerchantSubsidy; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| /** | |||
| * @author luozukai | |||
| */ | |||
| public interface WxBillSettleScheduleMapper extends CommonMapper<WxBillSettleSchedule, Long> { | |||
| void createScheduleFromBillSettle(@Param("id") Long id,@Param("settleReceivePay") Double settleReceivePay); | |||
| List<Long> listToSettleBillIdList(WxBillAll wxBillAll); | |||
| List<Long> listBillSettleBillBillId(@Param("settleId")Long settleId, @Param("type")Integer type); | |||
| Double calculteRentRecivePay(WxBillRent billRent); | |||
| Double calculteRentDepositRecivePay(WxBillRent billRent); | |||
| Double calcultePropertyRecivePay(WxBillProperty billProperty); | |||
| Double calcultePropertyDepositRecivePay(WxBillProperty billProperty); | |||
| Double calculteDailyRecivePay(WxBillDaily billDaily); | |||
| Double calculteOtherRecivePay0(WxBillOther billOther); | |||
| Double calculteOtherRecivePay1(WxBillOther billOther); | |||
| Double calculteOtherDepositRecivePay0(WxBillOther billOther); | |||
| Double calculteMerchantSubsidyRecivePay1(WxMerchantSubsidy merchantSubsidy); | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillSettle; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillAllVo; | |||
| import com.iformall.domain.vo.WxBillExcelTemplate; | |||
| @@ -23,9 +24,9 @@ public interface WxBillAllService { | |||
| Map<String, Object> listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); | |||
| List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | |||
| //List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | |||
| ResultData listBill(WxBillAll wxBillAll); | |||
| ResultData listBill(WxBillAll wxBillAll,WxMerchant wxMerchant); | |||
| void updateBill(Map<String, Object> bill); | |||
| @@ -81,5 +82,9 @@ public interface WxBillAllService { | |||
| void importBill(String importKey, WxBillExcelTemplate bill, MallUserInfo user); | |||
| void importBillOther(String importKey, WxBillExcelTemplateOther bill, MallUserInfo user); | |||
| Double calcuteSettleBillReceivePay(Long settleId); | |||
| void createBillSettleSchedule(Long settleId,Double settleReceivePay); | |||
| } | |||
| @@ -31,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.data.redis.core.StringRedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @@ -147,6 +149,15 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Lazy | |||
| @Autowired | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @Autowired | |||
| WxBillSettleScheduleMapper wxBillSettleScheduleMapper; | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| WxPayBillMapper wxPayBillMapper; | |||
| @Override | |||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | |||
| @@ -192,78 +203,93 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| } | |||
| } | |||
| @Override | |||
| public List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll) { | |||
| //更新各账单状态 | |||
| //updateBillStatus(wxBillAll); | |||
| ArrayList<Integer> statusList = new ArrayList<>(); | |||
| statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); | |||
| statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); | |||
| wxBillAll.setStatusList(statusList); | |||
| return wxBillAllMapper.listData(wxBillAll); | |||
| } | |||
| // @Override | |||
| // public List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll) { | |||
| // //更新各账单状态 | |||
| // //updateBillStatus(wxBillAll); | |||
| // ArrayList<Integer> statusList = new ArrayList<>(); | |||
| // statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); | |||
| // statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); | |||
| // wxBillAll.setStatusList(statusList); | |||
| // return wxBillAllMapper.listData(wxBillAll); | |||
| // } | |||
| @Override | |||
| public ResultData listBill(WxBillAll wxBillAll) { | |||
| public ResultData listBill(WxBillAll wxBillAll,WxMerchant wxMerchant) { | |||
| //更新各账单状态 | |||
| //updateBillStatus(wxBillAll); | |||
| PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize()); | |||
| List<Map<String, Object>> maps = null; | |||
| //账单类型 | |||
| if (wxBillAll.getBillTypeValue() != null) { | |||
| if (wxBillAll.getBillTypeValue().equals(EnumBillType.RENT.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.RENT.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.DEPOSIT.getCode())) { | |||
| wxBillAll.setBillTypeValue(null); | |||
| ArrayList typeList = new ArrayList(); | |||
| typeList.add(EnumBillTypeParam.RENT_DEPOSIT.getCode()); | |||
| typeList.add(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()); | |||
| typeList.add(EnumBillTypeParam.ATHER_DEPOSIT.getCode()); | |||
| wxBillAll.setTypeList(typeList); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.PROPERTY.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.PROPERTY.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.WATER.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.WATER.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.POWER.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.POWER.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.ROUTINE.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.ROUTINE.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.AIR_CONDITIONING.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.AIR_CONDITIONING.getCode()); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillType.SETTLE.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillTypeParam.SETTLE.getCode()); | |||
| if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); | |||
| maps = wxBillAllMapper.listRentBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); | |||
| maps = wxBillAllMapper.listRentDepositBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); | |||
| maps = wxBillAllMapper.listPropertyBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); | |||
| maps = wxBillAllMapper.listPropertyDepositBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); | |||
| maps = wxBillAllMapper.listDailyBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); | |||
| maps = wxBillAllMapper.listOtherBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); | |||
| maps = wxBillAllMapper.listOtherDepositBillData(wxBillAll); | |||
| } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.SETTLE.getCode())) { | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.SETTLE.getCode()); | |||
| maps = wxBillAllMapper.listSettleBillData(wxBillAll); | |||
| } else { | |||
| logger.info("账单不存在"); | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| } | |||
| if (wxBillAll.getPageIndex() != null && wxBillAll.getPageIndex() != null) { | |||
| PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize()); | |||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||
| for (Map<String, Object> map : maps) { | |||
| Integer billType = ((Long) map.get("billTypeValue")).intValue(); | |||
| if (EnumBillType.SETTLE.getCode().equals(billType)) { | |||
| Long id = (Long) map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); | |||
| map.put("owe", settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay", settle.getBalance()); | |||
| } | |||
| } | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(maps); | |||
| return new ResultData(pageInfo); | |||
| } | |||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||
| for (Map<String, Object> map : maps) { | |||
| Integer billType = ((Long) map.get("billTypeValue")).intValue(); | |||
| if (EnumBillType.SETTLE.getCode().equals(billType)) { | |||
| Long id = (Long) map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); | |||
| map.put("owe", settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay", settle.getBalance()); | |||
| } | |||
| if (null != maps) { | |||
| for (Map<String, Object> map : maps) { | |||
| Integer billType = ((Long) map.get("billTypeValue")).intValue(); | |||
| if (EnumBillType.SETTLE.getCode().equals(billType)) { | |||
| Long id = (Long) map.get("id"); | |||
| WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); | |||
| map.put("owe", settle.getBalance()); | |||
| settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); | |||
| map.put("receivePay", settle.getBalance()); | |||
| } | |||
| map.put("merchantName", wxMerchant.getName()); | |||
| Long shopId = (Long) map.get("shopId"); | |||
| if (null != shopId) { | |||
| Map param = new HashMap(); | |||
| param.put("id", shopId); | |||
| Map<String, Object> shopResult = wxShopMapper.getMerchantShopByShopId(param); | |||
| if (null != shopResult) { | |||
| map.put("shopNumber", shopResult.get("shopNumber")); | |||
| } | |||
| } | |||
| Long billId = (Long) map.get("id"); | |||
| WxPayBill wxPayBill = new WxPayBill(); | |||
| wxPayBill.updateTenantInfo(wxMerchant); | |||
| wxPayBill.setBillId(billId); | |||
| List<WxPayBill> payBillList = wxPayBillMapper.findList(wxPayBill); | |||
| if (null != payBillList && payBillList.size() > 0 ) { | |||
| WxPayBill pb = payBillList.get(0); | |||
| map.put("payBillStatus", pb.getPayBillStatus()); | |||
| map.put("tradeTime", pb.getPayTimeEnd()); | |||
| map.put("transactionId", pb.getTransactionId()); | |||
| map.put("payAmount", pb.getPayAmount()); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(maps); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(maps); | |||
| return new ResultData(pageInfo); | |||
| } | |||
| @Override | |||
| public void updateBill(Map<String, Object> bill) { | |||
| @@ -1906,4 +1932,68 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| }); | |||
| return wxBillAllVos; | |||
| } | |||
| @Override | |||
| public Double calcuteSettleBillReceivePay(Long settleId) { | |||
| List<Long> billIds0 = wxBillSettleScheduleMapper.listBillSettleBillBillId(settleId, 0); | |||
| Double pay0 = 0D; | |||
| if (null != billIds0 && billIds0.size() > 0 ) { | |||
| WxBillRent billRent = new WxBillRent(); | |||
| billRent.setIds(billIds0); | |||
| Double billRent0 = wxBillSettleScheduleMapper.calculteRentRecivePay(billRent);//租金 | |||
| Double billRentDeposit0 = wxBillSettleScheduleMapper.calculteRentDepositRecivePay(billRent);//租金押金 | |||
| WxBillProperty billProperty = new WxBillProperty(); | |||
| billProperty.setIds(billIds0); | |||
| Double billProperty0 = wxBillSettleScheduleMapper.calcultePropertyRecivePay(billProperty);//物业 | |||
| Double billPropertyDeposit0 = wxBillSettleScheduleMapper.calcultePropertyDepositRecivePay(billProperty);//物业押金 | |||
| WxBillDaily billDaily = new WxBillDaily(); | |||
| billDaily.setIds(billIds0); | |||
| Double billDaily0 = wxBillSettleScheduleMapper.calculteDailyRecivePay(billDaily); | |||
| WxBillOther billOther = new WxBillOther(); | |||
| billOther.setIds(billIds0); | |||
| Double billOther0 = wxBillSettleScheduleMapper.calculteOtherRecivePay0(billOther); | |||
| Double billOtherDeposit0 = wxBillSettleScheduleMapper.calculteOtherDepositRecivePay0(billOther); | |||
| pay0 = billRent0+billRentDeposit0+billProperty0+billPropertyDeposit0+billDaily0+billOther0+billOtherDeposit0; | |||
| } | |||
| List<Long> billIds1 = wxBillSettleScheduleMapper.listBillSettleBillBillId(settleId, 1); | |||
| Double pay1 = 0D; | |||
| if (null != billIds1 && billIds1.size() > 0 ) { | |||
| WxBillRent billRent = new WxBillRent(); | |||
| billRent.setIds(billIds1); | |||
| Double billRent1 = wxBillSettleScheduleMapper.calculteRentRecivePay(billRent);//租金 | |||
| Double billRentDeposit1 = wxBillSettleScheduleMapper.calculteRentDepositRecivePay(billRent);//租金押金 | |||
| WxBillProperty billProperty = new WxBillProperty(); | |||
| billProperty.setIds(billIds1); | |||
| Double billProperty1 = wxBillSettleScheduleMapper.calcultePropertyRecivePay(billProperty);//物业 | |||
| Double billPropertyDeposit1 = wxBillSettleScheduleMapper.calcultePropertyDepositRecivePay(billProperty);//物业押金 | |||
| WxBillDaily billDaily = new WxBillDaily(); | |||
| billDaily.setIds(billIds1); | |||
| Double billDaily1 = wxBillSettleScheduleMapper.calculteDailyRecivePay(billDaily); | |||
| WxBillOther billOther = new WxBillOther(); | |||
| billOther.setIds(billIds1); | |||
| Double billOther1 = wxBillSettleScheduleMapper.calculteOtherRecivePay1(billOther); | |||
| Double billOtherDeposit1 = wxBillSettleScheduleMapper.calculteOtherDepositRecivePay0(billOther); | |||
| WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | |||
| merchantSubsidy.setIds(billIds1); | |||
| Double billMerchantSubsidy1 = wxBillSettleScheduleMapper.calculteMerchantSubsidyRecivePay1(merchantSubsidy); | |||
| pay1 = billRent1+billRentDeposit1+billProperty1+billPropertyDeposit1+billDaily1+billOther1+billOtherDeposit1+billMerchantSubsidy1; | |||
| } | |||
| return pay0-pay1; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void createBillSettleSchedule(Long settleId, Double settleReceivePay) { | |||
| wxBillSettleScheduleMapper.createScheduleFromBillSettle(settleId, settleReceivePay); | |||
| wxBillSettleMapper.updateRecorded(settleId); | |||
| } | |||
| } | |||
| @@ -166,7 +166,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| public void updateFreezeOrStatus(List<WxBillSettleBill> billList,Integer freezeStatus,Integer status){ | |||
| //1租金2押金3物业4日常费用6其他8补贴 | |||
| for (WxBillSettleBill bill:billList) { | |||
| if(EnumBillType.RENT.getCode().equals(bill.getBillType())) { | |||
| if(EnumBillQueryType.RENT.getCode().equals(bill.getBillType())) { | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); | |||
| @@ -24,6 +24,7 @@ import com.iformall.utils.RedisLock; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @@ -48,6 +49,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| @Autowired | |||
| WxOrderMapper wxOrderMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxOrderService wxOrderService; | |||
| @@ -66,6 +68,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxRefundOrderService wxRefundOrderService; | |||
| @@ -279,6 +282,16 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| return new ResultData(Result.SUCCESS, "查询成功", group); | |||
| } | |||
| Map<String, Object> result = wxOrderGroupMapper.queryRemainOne(group); | |||
| if (null != result) { | |||
| Long cUserId = (Long) result.get("cUserId"); | |||
| if (null != cUserId) { | |||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(cUserId, wxOrderGroup.getFinalTenantId()); | |||
| if (null != user) { | |||
| result.put("nickName", user.getNickName()); | |||
| result.put("avatarUrl", user.getAvatarUrl()); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", result); | |||
| } | |||
| @@ -308,226 +308,7 @@ | |||
| </if> | |||
| </select> | |||
| <select id="listData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select bill.settle_number,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,DATEDIFF(now(),bill.receive_date) expiredDay,bill.status, | |||
| bill.tenant_id tenantId,bill.parent_tenant_id parentTenantId,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,bill.rent_shop_type | |||
| rentShopType,bill.price_detail priceDetail,bill.freeze,bill.late_pay_price latePayPrice,bill.service_charge_pay | |||
| serviceChargePay from ( | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | |||
| owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' | |||
| price_detail,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay | |||
| from wx_bill_rent | |||
| where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) | |||
| union all | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' | |||
| price_detail,freeze,0 late_pay_price,0 service_charge_pay | |||
| from wx_bill_rent_deposit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and rent_contract_id in (select id from wx_rent_contract | |||
| where status in (2,3,4)) | |||
| union all | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | |||
| owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' | |||
| price_detail,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay | |||
| from wx_bill_property | |||
| where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and property_contract_id in (select id from | |||
| wx_property_contract | |||
| where status in(2,3,4)) | |||
| union all | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' | |||
| price_detail,freeze,0 late_pay_price,0 service_charge_pay | |||
| from wx_bill_property_deposit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and property_contract_id in (select id from | |||
| wx_property_contract where status in | |||
| (2,3,4)) | |||
| union all | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | |||
| case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, | |||
| case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type, 0 as need_pay,receive_pay, | |||
| pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,starttime,endtime, | |||
| rent_shop_type,price_detail,freeze,0 late_pay_price,service_charge_pay | |||
| from wx_bill_daily where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| union all | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' | |||
| starttime,'' endtime,rent_shop_type,'' | |||
| price_detail,freeze,0 late_pay_price,service_charge_pay | |||
| from wx_bill_other where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| union all | |||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' | |||
| starttime,'' endtime,rent_shop_type,'' | |||
| price_detail,freeze,0 late_pay_price,service_charge_pay | |||
| from wx_bill_other_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| union all | |||
| select s.settle_number,s.id,s.merchant_id,'' shop_id,s.tenant_id,parent_tenant_id,'结算单' name, 10 bill_type_value,'结算单' bill_type,0 need_pay, | |||
| ((select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join | |||
| (select id,merchant_id,shop_id,tenant_id,parent_tenant_id,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,5 bill_type_value,'水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,6 bill_type_value,'电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,9 bill_type_value,'空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,7 bill_type_value,'其他费用' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | |||
| union all | |||
| select id,id merchant_id,'' shop_id,tenant_id,parent_tenant_id,10 bill_type_value,'补贴' bill_type,0 as | |||
| need_pay,subsidy receive_pay,0 pay,0 owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type from wx_merchant_subsidy | |||
| ) bill | |||
| on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=0) | |||
| - | |||
| (select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join | |||
| (select id,merchant_id,shop_id,tenant_id,parent_tenant_id,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,5 bill_type_value,'水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,6 bill_type_value,'电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,9 bill_type_value,'空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_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 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,parent_tenant_id,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) | |||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | |||
| union all | |||
| select id,id merchant_id,'' shop_id,tenant_id,parent_tenant_id,10 bill_type_value,'补贴' bill_type,0 as | |||
| need_pay,subsidy receive_pay,0 pay,subsidy owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type from wx_merchant_subsidy | |||
| ) bill | |||
| on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=1 | |||
| ) | |||
| ) receive_pay | |||
| ,0 pay,0 owe,s.createtime receive_date,'' pay_date,0 expired_day, | |||
| status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail, 0 freeze, | |||
| 0 late_pay_price,0 service_charge_pay | |||
| from wx_bill_settle s where s.status >0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) bill | |||
| 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_pay_bill pb on bill.id=pb.bill_id | |||
| where 1=1 | |||
| <sql id = "billSql" > | |||
| <if test=" null != id "> | |||
| and bill.id=#{id} | |||
| </if> | |||
| @@ -547,12 +328,6 @@ | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != typeList "> | |||
| and bill.`bill_type_value` in | |||
| <foreach collection="typeList" index="index" item="type" open="(" separator="," close=")"> | |||
| #{type} | |||
| </foreach> | |||
| </if> | |||
| <if test="null!=starttime and null!=endtime and ''!=starttime and ''!=endtime "> | |||
| and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime} | |||
| </if> | |||
| @@ -566,9 +341,92 @@ | |||
| and bill.rent_shop_type = #{rentShopType} | |||
| </if> | |||
| order by bill.merchant_id,bill.status desc,bill.receive_date desc | |||
| </sql> | |||
| <select id="listRentBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'租金' name,1 billTypeValue,'租金' billType, | |||
| need_pay needPay,receive_pay receivePay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) owe, | |||
| receive_date receiveDate,pay_date payDate,DATEDIFF(now(),receive_date) expiredDay,status,starttime,endtime,rent_shop_type rentShopType,'' priceDetail, | |||
| freeze,ifnull(late_pay_price,0) latePayPrice,service_charge_pay serviceChargePay | |||
| from wx_bill_rent bill | |||
| where bill.is_preview = 0 | |||
| and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listRentDepositBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchant_id,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'租赁押金' name,2 billTypeValue,'租赁押金' billType, | |||
| need_pay needPay,receive_pay receivePay,pay,(receive_pay-pay) owe,receive_date receiveDate,pay_date payDate,DATEDIFF(now(),receive_date) expiredDay, | |||
| status,starttime,endtime,rent_shop_type rentShopType,'' priceDetail,freeze,0 latePayPrice,0 serviceChargePay | |||
| from wx_bill_rent_deposit bill | |||
| where rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listPropertyBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'物业费' name,3 billTypeValue,'物业费' billType, | |||
| need_pay needPay,receive_pay receivePay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) owe,receive_date receiveDate,pay_date payDate, | |||
| DATEDIFF(now(),receive_date) expiredDay,status,starttime,endtime,rent_shop_type rentShopType,'' priceDetail,freeze,ifnull(late_pay_price,0) latePayPrice, | |||
| service_charge_pay serviceChargePay | |||
| from wx_bill_property bill | |||
| where is_preview = 0 | |||
| and property_contract_id in (select id from wx_property_contract where status in(2,3,4)) | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listPropertyDepositBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'物业押金' name,4 billTypeValue,'物业押金' billType, | |||
| need_pay needPay,receive_pay receivePay,pay,(receive_pay-pay) owe,receive_date receiveDate,pay_date payDate,DATEDIFF(now(),receive_date) expiredDay,status,starttime, | |||
| endtime,rent_shop_type rentShopType,'' priceDetail,freeze,0 latePayPrice,0 serviceChargePay | |||
| from wx_bill_property_deposit bill | |||
| where property_contract_id in (select id from wx_property_contract where status in (2,3,4)) | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listDailyBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId, | |||
| case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | |||
| case when type=1 then 5 when type=2 then 6 else 9 end billTypeValue, | |||
| case when type=1 then '水费' when type=2 then '电费' else '空调费' end billType, 0 as needPay,receive_pay receivePay, | |||
| pay,(receive_pay+service_charge_pay-pay) owe,receive_date receiveDate,pay_date payDate,DATEDIFF(now(),receive_date) expiredDay,status,starttime,endtime, | |||
| rent_shop_type rentShopType,price_detail priceDetail,freeze,0 latePayPrice,service_charge_pay serviceChargePay | |||
| from wx_bill_daily bill where bill.merchant_id=#{merchantId} | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listOtherBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,name,7 billTypeValue,'其他费用' billType,0 as needPay, | |||
| receive_pay receivePay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date receiveDate,pay_date payDate,DATEDIFF(now(),receive_date) expiredDay,status,'' starttime,'' endtime, | |||
| rent_shop_type rentShopType,'' priceDetail,freeze,0 latePayPrice,service_charge_pay serviceChargePay | |||
| from wx_bill_other bill where bill.merchant_id=#{merchantId} | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listOtherDepositBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select '' settle_number,id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,comments as name,8 billTypeValue,'其他押金' billType, | |||
| 0 as needPay,receive_pay receivePay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date receiveDate,pay_date payDate,DATEDIFF(now(),receive_date) expiredDay,status, | |||
| '' starttime,'' endtime,rent_shop_type rentShopType,'' priceDetail,freeze,0 latePayPrice,service_charge_pay serviceChargePay | |||
| from wx_bill_other_deposit bill where bill.merchant_id=#{merchantId} | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="listSettleBillData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select s.settle_number,s.id,s.merchant_id merchantId,'' shop_id shopId,s.tenant_id tenantId,parent_tenant_id parentTenantId,'结算单' name, 10 billTypeValue,'结算单' billType,0 needPay, | |||
| settle_receive_pay receivePay,0 pay,0 owe,createtime receiveDate,'' pay_date payDate,DATEDIFF(now(),receive_date) expiredDay, | |||
| status,'' starttime,'' endtime,'' rentShopType,'' priceDetail, 0 freeze,0 latePayPrice,0 serviceChargePay | |||
| from wx_bill_settle_schedule bill where bill.status >0 | |||
| <include refid="billSql"/> | |||
| </select> | |||
| <select id="getWaitPayBill" resultType="hashmap"> | |||
| select bill.tenant_id tenantId,bill.parent_tenant_id parentTenantId,bill.merchant_id merchantId,m.name merchantName,bill.receive_date receiveDate, | |||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType from ( | |||
| @@ -15,12 +15,12 @@ | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| <result column="merchantName" property="merchantName"/> | |||
| <result column="has_recorded" property="hasRecorded"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`, | |||
| `receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime` | |||
| `receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime`,`has_recorded` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -154,7 +154,9 @@ | |||
| </if> | |||
| </select> | |||
| <update id = "updateRecorded" parameterType = "hashmap"> | |||
| update wx_bill_settle set has_recorded = 1 where id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @@ -0,0 +1,147 @@ | |||
| <?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.WxBillSettleScheduleMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillSettleSchedule"> | |||
| <id column="id" property="id"/> | |||
| <result column="tenant_id" property="tenantId"/> | |||
| <result column="parent_tenant_id" property="parentTenantId"/> | |||
| <result column="settle_number" property="settleNumber"/> | |||
| <result column="merchant_id" property="merchantId"/> | |||
| <result column="status" property="status"/> | |||
| <result column="apply_status" property="applyStatus"/> | |||
| <result column="receiveMoney" property="receiveMoney"/> | |||
| <result column="payMoney" property="payMoney"/> | |||
| <result column="settletime" property="settletime"/> | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| <result column="merchantName" property="merchantName"/> | |||
| <result column="settle_receive_pay" property="settleReceivePay"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`, | |||
| `receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime`,`settle_receive_pay` | |||
| </sql> | |||
| <insert id = "createScheduleFromBillSettle" parameterType= "hashmap"> | |||
| insert into wx_bill_settle_schedule(`id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`,`receive_money`,`pay_money`,`settletime`,`createtime`, | |||
| `updatetime`,`settle_receive_pay`) | |||
| select `id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`,`receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime`,#{settleReceivePay} | |||
| from wx_bill_settle where id = #{id} | |||
| </insert> | |||
| <select id="listToSettleBillIdList" resultType="Long" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select s.id from wx_bill_settle s where has_recorded != 1 and s.status > 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="listBillSettleBillBillId" resultType="Long" parameterType="hashmap"> | |||
| select bb.bill_id from wx_bill_settle_bill bb where bb.settle_id = #{settleId} and bb.type=#{type} | |||
| </select> | |||
| <select id="calculteRentRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay)),0) owe | |||
| from wx_bill_rent where is_preview = 0 and tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteRentDepositRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| select IFNULL(sum( (receive_pay-pay)),0) owe | |||
| from wx_bill_rent_deposit where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calcultePropertyRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay)),0) owe | |||
| from wx_bill_property where is_preview = 0 and tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calcultePropertyDepositRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| select IFNULL(sum( (receive_pay-pay)),0) owe | |||
| from wx_bill_property_deposit where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteDailyRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillDaily"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay-pay)),0) owe | |||
| from wx_bill_daily where tenant_id = #{tenantId} and type in (1,2,3) | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteOtherRecivePay0" resultType="Double" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay-pay)),0) owe | |||
| from wx_bill_other where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteOtherRecivePay1" resultType="Double" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| select IFNULL(sum( owe ),0) owe | |||
| from wx_bill_other where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteOtherDepositRecivePay0" resultType="Double" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay-pay)),0) owe | |||
| from wx_bill_other_deposit where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteMerchantSubsidyRecivePay1" resultType="Double" parameterType="com.iformall.domain.po.WxMerchantSubsidy"> | |||
| select IFNULL(sum( subsidy),0) owe | |||
| from wx_merchant_subsidy where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -57,11 +57,8 @@ | |||
| </select> | |||
| <select id="queryRemainOne" parameterType="com.iformall.domain.po.WxOrderGroup" resultType="hashmap"> | |||
| select o.press_end_date expiredDate,o.order_group_id orderGroupId,c.nick_name nickName, | |||
| c.avatar_url avatarUrl,o.id orderId,o.product_id couponId | |||
| select o.press_end_date expiredDate,o.order_group_id orderGroupId,o.id orderId,o.product_id couponId,o.c_user_id cUserId | |||
| from wx_order o | |||
| left join wx_c_user_basic_info c on o.c_user_id=c.id | |||
| where o.id=#{orderId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||