Просмотр исходного кода

Merge branch 'release_toaliyun_real_2022_init' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_2022_init

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
60a8c581a7
30 измененных файлов: 991 добавлений и 470 удалений
  1. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java
  2. +22
    -0
      mallinkAdmin/src/main/resources/db/migration/V2022012000001__optimize.sql
  3. +24
    -21
      mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java
  4. +36
    -3
      mallinkBApi/src/main/java/com/iformall/controller/WxPayBillController.java
  5. +51
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/BillSchedule.java
  6. +7
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java
  7. +6
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java
  8. +6
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java
  9. +9
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxBillSettle.java
  10. +66
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillSettleSchedule.java
  11. +6
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantSubsidy.java
  12. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxPayBill.java
  13. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java
  14. +52
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumBillQueryType.java
  15. +34
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumHasRecorded.java
  16. +24
    -3
      mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java
  17. +4
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillSettleMapper.java
  18. +35
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillSettleScheduleMapper.java
  19. +8
    -2
      mallinkService/src/main/java/com/iformall/service/WxBillAllService.java
  20. +2
    -1
      mallinkService/src/main/java/com/iformall/service/WxPayBillService.java
  21. +230
    -67
      mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java
  22. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java
  23. +13
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java
  24. +28
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java
  25. +160
    -344
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  26. +5
    -3
      mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml
  27. +147
    -0
      mallinkService/src/main/resources/mapper/WxBillSettleScheduleMapper.xml
  28. +1
    -4
      mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml
  29. +7
    -1
      mallinkService/src/main/resources/mapper/WxPayBillMapper.xml
  30. +1
    -1
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java Просмотреть файл

@@ -218,6 +218,7 @@ public class WxBillAllController extends BaseController {
wxBillAll.setEndtime(wxBillAll.getEndtime() + " 23:59:59");
}
wxBillAll.updateTenantInfo(getTenantInfo());
wxBillAllService.exportOweBill(wxBillAll, request, response);
}



+ 22
- 0
mallinkAdmin/src/main/resources/db/migration/V2022012000001__optimize.sql Просмотреть файл

@@ -1009,3 +1009,25 @@ 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='结算单';

ALTER TABLE `wx_pay_bill` ADD COLUMN `bill_type_value` int(1) NOT NULL DEFAULT 0 COMMENT '账单类型' ;



+ 24
- 21
mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java Просмотреть файл

@@ -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.pageListBill(wxBillAll,wxMerchant,true,true,true);
}




+ 36
- 3
mallinkBApi/src/main/java/com/iformall/controller/WxPayBillController.java Просмотреть файл

@@ -4,10 +4,12 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxPayBill;
import com.iformall.enums.EnumPayStatus;
import com.iformall.enums.EnumPayWay;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxPayBillService;
import com.iformall.utils.IPUtil;
import io.swagger.annotations.Api;
@@ -32,8 +34,11 @@ public class WxPayBillController extends BaseController {

@Autowired
private WxPayBillService wxPayBillService;
@Autowired
WxMerchantService wxMerchantService;

@ApiOperation(value = "发起微信小程序支付订单", notes = "{\"billId\":\"string\",\"appId\":\"string\",\"openId\":\"string\",\"bUserId\":\"string\"}")
@ApiOperation(value = "发起微信小程序支付订单", notes = "{\"billTypeValue\":\"string\",\"billId\":\"string\",\"appId\":\"string\",\"openId\":\"string\",\"bUserId\":\"string\",\"merchantId\":\"string\"}")
@RequestMapping(value = "/create", method = RequestMethod.POST)
public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception {
logger.info("/api/pay/create" + paramMap.toString());
@@ -50,11 +55,39 @@ public class WxPayBillController extends BaseController {
} catch (NumberFormatException e) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "billId参数不正确");
}
String billTypeValueStr = paramMap.get("billTypeValue");
if (StringUtils.isEmpty(billTypeValueStr)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "billTypeValue不能为空");
}
Integer billTypeValue = null;
try {
billTypeValue = Integer.parseInt(billTypeValueStr);
} catch (NumberFormatException e) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "billTypeValue参数不正确");
}
String merchantIdStr = paramMap.get("merchantId");
if (StringUtils.isEmpty(merchantIdStr)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空");
}
Long merchantId = null;
try {
merchantId = Long.parseLong(merchantIdStr);
} catch (NumberFormatException e) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId参数不正确");
}
WxMerchant wxMerchant = wxMerchantService.getById(merchantId);
if(wxMerchant==null){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}

//b_user_id
String bUserIdStr = paramMap.get("bUserId");
if (StringUtils.isEmpty(bUserIdStr)) {
logger.info("bUserId不能为空: " + paramMap.toString());
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "bUserId不能为空");
}

@@ -79,7 +112,7 @@ public class WxPayBillController extends BaseController {
record.updateTenantInfo(getTenantInfo());
try {
record.setIp(IPUtil.getIpAddr(request));
return wxPayBillService.createPayBill(appInfo, record, EnumPayWay.PAY_WAY_WECHAT);
return wxPayBillService.createPayBill(wxMerchant,billTypeValue,appInfo, record, EnumPayWay.PAY_WAY_WECHAT);
} catch (MallinkException e) {
logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());


+ 51
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/BillSchedule.java Просмотреть файл

@@ -0,0 +1,51 @@
package com.iformall.schedule;

import com.iformall.domain.vo.WxBillAll;
import com.iformall.mapper.WxBillAllMapper;
import com.iformall.mapper.WxBillSettleScheduleMapper;
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
WxBillAllService wxBillAllService;
@Autowired
WxBillSettleScheduleMapper wxBillSettleScheduleMapper;

/**
* 每天1点执行
* 结算账单
*/
@Async
@Scheduled(cron = "0 0 1 * * ?")
public void settleBill() {
WxBillAll wxBillAll = new WxBillAll();
//wxBillAll.updateTenantInfo(wxBillAll);
List<Long> settleBillIdList = wxBillSettleScheduleMapper.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);
}
}
}
}

}

+ 7
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java Просмотреть файл

@@ -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)


+ 6
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java Просмотреть файл

@@ -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)


+ 6
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java Просмотреть файл

@@ -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)


+ 9
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxBillSettle.java Просмотреть файл

@@ -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")


+ 66
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxBillSettleSchedule.java Просмотреть файл

@@ -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;

}

+ 6
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantSubsidy.java Просмотреть файл

@@ -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;


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxPayBill.java Просмотреть файл

@@ -26,6 +26,7 @@ public class WxPayBill extends TenantEntity {
private Long billId;
@io.swagger.annotations.ApiModelProperty(value="用户ID",name="bUserId")
private Long bUserId;
@io.swagger.annotations.ApiModelProperty(value="ip地址",name="ip")
private String ip;
@io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount")
@@ -53,6 +54,9 @@ public class WxPayBill extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="openId",name="openId")
private String openId;
@io.swagger.annotations.ApiModelProperty(value="billTypeValue",name="billTypeValue")
private Integer billTypeValue;


public Long getbUserId() {


+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java Просмотреть файл

@@ -82,7 +82,7 @@ public class WxBillAll extends TenantEntity {
private Integer totalOwe;

private List<Integer> billTypeList;
private List<Long> merchantIdList;

@TableField(exist = false)
@SortColumn(column = "rentReceivePay")


+ 52
- 0
mallinkService/src/main/java/com/iformall/enums/EnumBillQueryType.java Просмотреть файл

@@ -0,0 +1,52 @@
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 Integer getRealType(Integer type) {
//查询的列表数据中 5:水费 6:电费 9:空调费
if (type == 5 || type == 6 || type == 9) {
return WATER_POWER_AIR.getCode();
}
return type;
}
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;
}
}

+ 34
- 0
mallinkService/src/main/java/com/iformall/enums/EnumHasRecorded.java Просмотреть файл

@@ -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;
}
}

+ 24
- 3
mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java Просмотреть файл

@@ -1,25 +1,46 @@
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
*/
public interface WxBillAllMapper {


List<WxBillAllVo> list(WxBillAll record);
List<WxBillAllVo> listRentBill(WxBillAll record);
List<WxBillAllVo> listRentDepositBill(WxBillAll record);
List<WxBillAllVo> listPropertyBill(WxBillAll record);
List<WxBillAllVo> listPropertyDepositBill(WxBillAll record);
List<WxBillAllVo> listDailyBill(WxBillAll record);
List<WxBillAllVo> listOtherBill(WxBillAll record);
List<WxBillAllVo> listOtherDepositBill(WxBillAll record);

Map<String,Object> queryOweInfo(WxBillAll record);

Map<String,Object> queryPaidInfo(WxBillAll record);

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
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillSettleMapper.java Просмотреть файл

@@ -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);


}

+ 35
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillSettleScheduleMapper.java Просмотреть файл

@@ -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);
}

+ 8
- 2
mallinkService/src/main/java/com/iformall/service/WxBillAllService.java Просмотреть файл

@@ -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,10 @@ 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 pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay);
List<Map<String, Object>> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay);

void updateBill(Map<String, Object> bill);

@@ -81,5 +83,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);

}

+ 2
- 1
mallinkService/src/main/java/com/iformall/service/WxPayBillService.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.iformall.service;

import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxPayBill;
import com.iformall.enums.EnumPayWay;

@@ -19,7 +20,7 @@ public interface WxPayBillService {
* @param payWay
* @return
*/
ResultData createPayBill(WxAppinfo appInfo, WxPayBill record, EnumPayWay payWay);
ResultData createPayBill(WxMerchant merchant,Integer billTypeValue,WxAppinfo appInfo, WxPayBill record, EnumPayWay payWay);

/**
* 微信支付订单查询


+ 230
- 67
mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java Просмотреть файл

@@ -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,18 @@ public class WxBillAllServiceImpl implements WxBillAllService {
@Lazy
@Autowired
WxPayAccountBillService wxPayAccountBillService;
@Autowired
WxBillSettleScheduleMapper wxBillSettleScheduleMapper;
@Autowired
WxShopMapper wxShopMapper;
@Autowired
WxPayBillMapper wxPayBillMapper;
@Autowired
WxMerchantMapper wxMerchantMapper;

@Override
public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) {
@@ -156,7 +170,8 @@ public class WxBillAllServiceImpl implements WxBillAllService {
List<Integer> typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class);
record.setTypeList(typeList);
}
PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record));
PageHelper.startPage(pageIndex, pageSize);
PageInfo<WxBillAllVo> pageInfo = new PageInfo<>(list(record));

//手续费 = 合同应收+手续费+滞纳金
pageInfo.getList().stream().forEach(e -> {
@@ -168,6 +183,67 @@ public class WxBillAllServiceImpl implements WxBillAllService {
result.put("pageInfo", pageInfo);
return result;
}
private List<WxBillAllVo> list(WxBillAll wxBillAll) {
List<WxBillAllVo> retList = null;
wxBillAll.setBillTypeValue(EnumBillQueryType.getRealType(wxBillAll.getBillTypeValue()));
if (!StringUtils.isBlank(wxBillAll.getMerchantName())) {
WxMerchant wxMerchantQ = new WxMerchant();
wxMerchantQ.setName(StringUtils.trimToNull(wxBillAll.getMerchantName()));
List<Long> mids = wxMerchantMapper.findIdList(wxMerchantQ);
if (null != mids && mids.size() > 0 ) {
wxBillAll.setMerchantIdList(mids);
}
}
if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode());
retList = wxBillAllMapper.listRentBill(wxBillAll);
} else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode());
retList = wxBillAllMapper.listRentDepositBill(wxBillAll);
} else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode());
retList = wxBillAllMapper.listPropertyBill(wxBillAll);
} else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode());
retList = wxBillAllMapper.listPropertyDepositBill(wxBillAll);
} else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode());
retList = wxBillAllMapper.listDailyBill(wxBillAll);
} else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode());
retList = wxBillAllMapper.listOtherBill(wxBillAll);
} else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) {
wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode());
retList = wxBillAllMapper.listOtherDepositBill(wxBillAll);
} else {
logger.info("账单不存在");
}
if (null != retList && retList.size() > 0 ){
for (int i = 0 ; i < retList.size(); i ++) {
WxBillAllVo vo = retList.get(i);
if( null!= vo.getMerchantId() ) {
WxMerchant wxMerchantQ = new WxMerchant();
wxMerchantQ.setId(vo.getMerchantId());
List<WxMerchant> mlist = wxMerchantMapper.findIdNameList(wxMerchantQ);
if (null != mlist && mlist.size() > 0 ) {
vo.setMerchantName(mlist.get(0).getName());
}
}
if (null != vo.getShopId()) {
Map param = new HashMap();
param.put("id", vo.getShopId());
Map<String, Object> shop = wxShopMapper.getMerchantShopByShopId(param);
if ( null != shop) {
vo.setShopNumber((String)shop.get("shopNumber"));
vo.setManager((String)shop.get("manager"));
vo.setManagerPhone((String)shop.get("managerPhone"));
}
}
}
}
return retList;
}

public void cmputeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillAllVo e) {
if (e.getReceivePay() != null) {
@@ -192,78 +268,102 @@ 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) {
public ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay) {
//更新各账单状态
//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);
PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize());
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(listBill(wxBillAll, wxMerchant,true, hasShop, hasPayBill, hasReceivePay));
return new ResultData(pageInfo);
}

@Override
public ResultData listBill(WxBillAll wxBillAll) {
//更新各账单状态
//updateBillStatus(wxBillAll);
public List<Map<String, Object>> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay){
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());
} 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);
wxBillAll.setBillTypeValue(EnumBillQueryType.getRealType(wxBillAll.getBillTypeValue()));
wxBillAll.setMerchantId(wxMerchant.getId());
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("账单不存在");
}
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 && hasSet) {
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());
if (hasReceivePay) {
settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode());
map.put("receivePay", settle.getBalance());
}
}
map.put("merchantName", wxMerchant.getName());
if (hasShop) {
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"));
}
}
}
if (hasPayBill) {
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);
return maps;
}

@Override
public void updateBill(Map<String, Object> bill) {
@@ -357,8 +457,7 @@ public class WxBillAllServiceImpl implements WxBillAllService {

@Override
public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) {

Map<Long, List<WxBillAllVo>> collect = wxBillAllMapper.list(wxBillAll)
Map<Long, List<WxBillAllVo>> collect = list(wxBillAll)
.stream().filter(b -> null != b.getMerchantId())
.collect(Collectors.groupingBy(WxBillAllVo::getMerchantId));
Set<Map.Entry<Long, List<WxBillAllVo>>> entries = collect.entrySet();
@@ -789,7 +888,7 @@ public class WxBillAllServiceImpl implements WxBillAllService {
result.put("endtime", " ");
}
Integer filterHasPay = wxBillAll.getFilterHasPay();
List<WxBillAllVo> list = wxBillAllMapper.list(wxBillAll);
List<WxBillAllVo> list = list(wxBillAll);
if (!list.isEmpty()) {
//租金总额
Long rentSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode()))
@@ -1906,4 +2005,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);
}
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java Просмотреть файл

@@ -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);


+ 13
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java Просмотреть файл

@@ -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);
}



+ 28
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java Просмотреть файл

@@ -9,6 +9,8 @@ import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxBillSettle;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.WxPayBill;
import com.iformall.domain.vo.WxBillAll;
@@ -18,12 +20,15 @@ import com.iformall.mapper.*;
import com.iformall.pay.*;
import com.iformall.service.WxBillAllService;
import com.iformall.service.WxBillSettleService;
import com.iformall.service.WxMerchantBUserService;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxPayBillService;
import com.iformall.utils.*;
import org.apache.commons.lang3.StringUtils;
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;
@@ -50,14 +55,24 @@ public class WxPayBillServiceImpl implements WxPayBillService {
@Autowired
WxBillAllMapper wxBillAllMapper;

@Lazy
@Autowired
WxBillAllService wxBillAllService;

@Autowired
WxMerchantBUserMapper wxMerchantBUserMapper;

@Lazy
@Autowired
private WxBillSettleService wxBillSettleService;
@Lazy
@Autowired
WxMerchantBUserService wxMerchantBUserService;
@Lazy
@Autowired
WxMerchantService wxMerchantService;

JSONObject errorMap = JSON.parseObject("{" +
"\"NOAUTH\":{\"detail\":\"商户无此接口权限\",\"reason\":\"商户未开通此接口权限\",\"resolution\":\"请商户前往申请此接口权限\"}," +
@@ -89,7 +104,7 @@ public class WxPayBillServiceImpl implements WxPayBillService {
"\"XML_FORMAT_ERROR\":{\"detail\":\"XML格式错误\t\",\"reason\":\"XML格式错误\",\"reason\":\"请检查XML参数格式是否正确\"}}");

@Override
public ResultData createPayBill(WxAppinfo appInfo, WxPayBill record, EnumPayWay payWay) {
public ResultData createPayBill(WxMerchant merchant,Integer billTypeValue,WxAppinfo appInfo, WxPayBill record, EnumPayWay payWay) {
final IdWorker idworker = IdWorker.get();

EnumPayShare isShare = EnumPayShare.NO;
@@ -98,7 +113,8 @@ public class WxPayBillServiceImpl implements WxPayBillService {
WxBillAll wxBillAll = new WxBillAll();
wxBillAll.updateTenantInfo(record);
wxBillAll.setId(record.getBillId());
List<Map<String, Object>> bills = wxBillAllMapper.listData(wxBillAll);
wxBillAll.setBillTypeValue(billTypeValue);
List<Map<String, Object>> bills = wxBillAllService.listBill(wxBillAll,merchant,true,false,false,false);
if (bills.size()==0) {
logger.error("pay bill, bill not allow, repaymentReq: " + JSONObject.toJSONString(record) + ", payWay: " + payWay.toString());
throw new MallinkException(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND);
@@ -106,14 +122,7 @@ public class WxPayBillServiceImpl implements WxPayBillService {
//获取账单数据
Map<String, Object> bill = bills.get(0);
Long owe = (Long) bill.get("owe");
Integer billTypeValue = ((Long) bill.get("billTypeValue")).intValue();

if(EnumBillType.SETTLE.getCode().equals(billTypeValue)){
WxBillSettle wxBillSettle = wxBillSettleService.getById(record.getBillId(), EnumFilterSettle.YES.getCode());
owe = wxBillSettle.getBalance();
bill.put("owe",owe);
logger.info("wxBillSettle.balance:{}",owe);
}
if (owe.longValue() <= 0) {
logger.info("账单欠缴为0");
return new ResultData(ErrorCode.BILL_OWE_ZERO);
@@ -144,7 +153,7 @@ public class WxPayBillServiceImpl implements WxPayBillService {
record.setPayVendor(payWay.getCode());
record.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode());
record.setShare(isShare.getCode());
record.setBillTypeValue(billTypeValue);
int sqlRow = wxPayBillMapper.insert(record);
if (sqlRow != 1) {
logger.error("pay bill insert error: " + JSONObject.toJSONString(record));
@@ -711,7 +720,10 @@ public class WxPayBillServiceImpl implements WxPayBillService {
wxPayBillMapper.updateById(record);
WxBillAll wxBillAll = new WxBillAll();
wxBillAll.setId(record.getBillId());
List<Map<String, Object>> bills = wxBillAllMapper.listData(wxBillAll);
wxBillAll.setBillTypeValue(record.getBillTypeValue());
WxMerchantBUser buser = wxMerchantBUserService.getById(record.getbUserId());
WxMerchant wxMerchant = wxMerchantService.getById(buser.getMerchantId());
List<Map<String, Object>> bills = wxBillAllService.listBill(wxBillAll, wxMerchant,false, false, false, false);
if (bills.size() > 0) {
Map<String, Object> bill = bills.get(0);
bill.put("userId", record.getbUserId());
@@ -726,7 +738,7 @@ public class WxPayBillServiceImpl implements WxPayBillService {
WxBillAll wxBillAll = new WxBillAll();
wxBillAll.setId(record.getBillId());
wxBillAll.updateTenantInfo(record);
List<Map<String, Object>> bills = wxBillAllMapper.listData(wxBillAll);
List<Map<String, Object>> bills = wxBillAllService.listBill(wxBillAll, null,false, false, false, false);
if (bills.size()==0) {
logger.error("pay success handle, bill " + record.getBillId() + " not found , payBillNo : " + record.getPayBillNo());
throw new MallinkException(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND);
@@ -769,7 +781,10 @@ public class WxPayBillServiceImpl implements WxPayBillService {
}
WxBillAll wxBillAll = new WxBillAll();
wxBillAll.setId(record.getBillId());
List<Map<String, Object>> bills = wxBillAllMapper.listData(wxBillAll);
wxBillAll.setBillTypeValue(record.getBillTypeValue());
WxMerchantBUser buser = wxMerchantBUserService.getById(record.getbUserId());
WxMerchant wxMerchant = wxMerchantService.getById(buser.getMerchantId());
List<Map<String, Object>> bills = wxBillAllService.listBill(wxBillAll, wxMerchant,false, false, false, false);
if (bills.size()==0) {
logger.error("pay handle, bill " + record.getBillId() + " not found , payBillNo : " + record.getPayBillNo());
throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND);


+ 160
- 344
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml Просмотреть файл

@@ -46,112 +46,8 @@
<result column="service_charge_pay" property="serviceChargePay"/>

</resultMap>


<select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">

select
bill.id,bill.tenant_id tenantId,bill.parent_tenant_id parentTenantId,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,expired_day expiredDay,bill.status,bill.starttime,
bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName,
s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info
shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze,bill.late_pay_price,bill.service_charge_pay
from (
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,''
price_detail,updatetime,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>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,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>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,''
price_detail,updatetime,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>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,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>
union all
select 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,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,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 id,merchant_id,shop_id,tenant_id,parent_tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,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 id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as
bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,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>
) bill
left join wx_merchant m on bill.merchant_id=m.id
left join wx_shop s on bill.shop_id=s.id
where 1=1
<sql id = "billConditionSql" >
<if test=" null != tenantId and '' != tenantId">
and bill.`tenant_id` = #{tenantId}
</if>
@@ -161,8 +57,6 @@
<if test=" null != month and ''!=month">
and date_format(bill.receive_date,'%Y-%m')=#{month}
</if>
<if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
<if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if>
<if test=" null != status ">and bill.`status` = #{status}</if>
<if test=" null != rentShopType ">and bill.rent_shop_type = #{rentShopType}</if>
<if test=" null != starttime and null!= endtime and '' != starttime and ''!= endtime ">
@@ -178,19 +72,87 @@
</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 != freeze ">and bill.freeze = #{freeze}</if>
<if test=" null != id ">and bill.id = #{id}</if>
<if test=" null != merchantIdList ">
and bill.`merchant_id` in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status</if>
</sql>

<select id="listRentBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select 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,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,
case when shop_info is null then '[]' else shop_info end shopInfo,
comments,'' price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_rent bill
where is_preview = 0
<include refid="billConditionSql"/>
</select>
<select id="listRentDepositBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'租赁押金' name,2 billTypeValue,'租赁押金' billType,
need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,shop_info shopInfo,NULL comments,'' price_detail,updatetime,freeze,0 late_pay_price,0 service_charge_pay
from wx_bill_rent_deposit bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listPropertyBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select 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,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,case when shop_info is null then '[]' else shop_info end shopInfo,comments,'' price_detail,updatetime,
freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_property bill
where is_preview = 0
<include refid="billConditionSql"/>
</select>
<select id="listPropertyDepositBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select 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,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,shop_info shopInfo,NULL comments,'' price_detail,updatetime,freeze,0 late_pay_price,0 service_charge_pay
from wx_bill_property_deposit bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listDailyBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select 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,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime,
rent_shop_type rentShopType,'[]' shopInfo, NULL comments,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_daily bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listOtherBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,name,7 billTypeValue,concat('其他费用-',name) as billType,
0 as need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime,
rent_shop_type rentShopType,'[]' shopInfo,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listOtherDepositBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,comments as name,8 billTypeValue,concat('其他押金-',comments) as
billType,0 as needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime,
rent_shop_type rentShopType,'[]' shopInfo,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other_deposit bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
@@ -308,226 +270,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>
@@ -546,29 +289,102 @@
#{status}
</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>
<if test=" null != status ">
and bill.status=#{status}
</if>
<if test=" null != billTypeValue ">
and bill.bill_type_value=#{billTypeValue}
</if>
<if test=" null != rentShopType ">
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 (


+ 5
- 3
mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml Просмотреть файл

@@ -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>


+ 147
- 0
mallinkService/src/main/resources/mapper/WxBillSettleScheduleMapper.xml Просмотреть файл

@@ -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>


+ 1
- 4
mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml Просмотреть файл

@@ -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}


+ 7
- 1
mallinkService/src/main/resources/mapper/WxPayBillMapper.xml Просмотреть файл

@@ -22,10 +22,12 @@
<result column="share_amount" jdbcType="INTEGER" property="shareAmount"/>
<result column="fail_reason" jdbcType="VARCHAR" property="failReason"/>
<result column="open_id" jdbcType="VARCHAR" property="openId"/>
<result column="bill_type_value" jdbcType="VARCHAR" property="billTypeValue"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`b_user_id`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`,`prepay_id`,`transaction_id`,`pay_vendor`,`pay_bill_no`,`pay_bill_status`,`share`,`share_amount`,`fail_reason`,`open_id`
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`b_user_id`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`,`prepay_id`,`transaction_id`,`pay_vendor`,
`pay_bill_no`,`pay_bill_status`,`share`,`share_amount`,`fail_reason`,`open_id`,`bill_type_value`
</sql>

<sql id="dynamicWhereConditions">
@@ -85,6 +87,10 @@
<if test=" null != payVendor ">
and `pay_vendor` = #{payVendor}
</if>
<if test=" null != billTypeValue ">
and `bill_type_value` = #{billTypeValue}
</if>

<if test=" null != payBillNo ">
and `pay_bill_no` like concat('%', #{payBillNo},'%')


+ 1
- 1
mallinkService/src/main/resources/mapper/WxShopMapper.xml Просмотреть файл

@@ -437,7 +437,7 @@
<select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
select
s.id,s.build_area buildArea,s.operation_area operationArea,s.shop_number shopNumber
s.id,s.build_area buildArea,s.operation_area operationArea,s.shop_number shopNumber, s.manager, s.manager_phone managerPhone
from wx_shop s
where s.id = #{id} and s.is_del=0
</select>


Загрузка…
Отмена
Сохранить