Преглед изворни кода

Merge branch 'develop' into devlocal

release_toaliyun_real
Burce пре 6 година
родитељ
комит
770e7fc1f4
17 измењених фајлова са 292 додато и 92 уклоњено
  1. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V201908221610__POS_CHANGED.sql
  2. +75
    -34
      mallinkBApi/src/main/java/com/iformall/controller/PosController.java
  3. +15
    -7
      mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java
  4. +113
    -8
      mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java
  5. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/PosOrder.java
  6. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java
  7. +12
    -8
      mallinkService/src/main/java/com/iformall/enums/EnumPosOrderStatus.java
  8. +1
    -0
      mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java
  9. +10
    -1
      mallinkService/src/main/java/com/iformall/service/PosPayOrderService.java
  10. +4
    -0
      mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java
  11. +6
    -0
      mallinkService/src/main/java/com/iformall/service/impl/PosPayOrderServiceImpl.java
  12. +6
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java
  13. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java
  14. +4
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java
  15. +13
    -14
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  16. +24
    -10
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  17. +1
    -1
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml

+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V201908221610__POS_CHANGED.sql Прегледај датотеку

@@ -0,0 +1,2 @@
alter table wx_pos_order
add `remain_amount` int(11) default NULL COMMENT '支付金额:允许有负数,退款时为负值。核销时,金额可以不填写' after `payment`;

+ 75
- 34
mallinkBApi/src/main/java/com/iformall/controller/PosController.java Прегледај датотеку

@@ -31,7 +31,7 @@ public class PosController extends BaseController {
return posService.checkAvaiable(); return posService.checkAvaiable();
} }


@ApiOperation(value = "商户POS用户/B端用户登录检查")
@ApiOperation(value = "商户POS用户/B端用户登录检查", notes = "{\"phone\":\"string\", \"password\":\"string(单位:分)\"}")
@PostMapping("checkUserPassword") @PostMapping("checkUserPassword")
public ResultData checkUserPassword(@RequestBody Map<String, String> params) { public ResultData checkUserPassword(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser(); WxMerchantBUser user = getUser();
@@ -59,7 +59,36 @@ public class PosController extends BaseController {
return posService.getQrCode(getTenantId()); return posService.getQrCode(getTenantId());
} }


@ApiOperation(value = "会员识别")
@ApiOperation(value = "券独立核销-1-检查", notes = "{\"couponOrderId\":\"string\"}")
@PostMapping("checkCouponOrderForIndepentVerify")
public ResultData checkCouponOrderForIndepentVerify(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser();
String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID

if (StringUtils.isBlank(couponOrderIdStr)) {
String errMessage = "request params[coupon_order_id] error.";
logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
String verifyType = WxPayConstant.VERIFY_TYPE_INDEPENT;
return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr);
}

@ApiOperation(value = "券独立核销-2-核销", notes = "{\"couponOrderId\":\"string\", \"payment\":\"string(单位:分)\"}")
@PostMapping("posVerifyIndepent")
public ResultData posVerifyIndepent(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser();
String couponOrderId = params.get("coupon_order_id");
String payment = params.get("payment");
if (StringUtils.isBlank(couponOrderId)) {
String errMessage = "券ID为空";
logger.error(errMessage);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
return posService.posVerifyIndepent(user, couponOrderId, payment);
}

@ApiOperation(value = "会员支付-1-会员识别", notes = "{\"mem_id\":\"string(可选)\",\"mem_phone\":\"string(可选)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(单位:分)(必填)\"}")
@PostMapping("checkMem") @PostMapping("checkMem")
public ResultData checkMem(@RequestBody Map<String, String> params) { public ResultData checkMem(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser(); WxMerchantBUser user = getUser();
@@ -87,26 +116,39 @@ public class PosController extends BaseController {
return posService.checkMem(user, memIdStr, memPhoneStr, posOrderIdStr, posAmountStr); return posService.checkMem(user, memIdStr, memPhoneStr, posOrderIdStr, posAmountStr);
} }


@ApiOperation(value = "券独立核销检查")
@PostMapping("checkCouponOrderForIndepentVerify")
public ResultData checkCouponOrderForIndepentVerify(@RequestBody Map<String, String> params) {
@ApiOperation(value = "会员支付-2-交易核销检查", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}")
@PostMapping("checkCouponOrderForPayVerify")
public ResultData checkCouponOrderForPayVerify(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser(); WxMerchantBUser user = getUser();
String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID
String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID
String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额


if (StringUtils.isBlank(couponOrderIdStr)) { if (StringUtils.isBlank(couponOrderIdStr)) {
String errMessage = "request params[coupon_order_id] error."; String errMessage = "request params[coupon_order_id] error.";
logger.error(errMessage); logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
} }
String verifyType = WxPayConstant.VERIFY_TYPE_INDEPENT;
return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr);
if (StringUtils.isBlank(posOrderIdStr)) {
String errMessage = "request params[pos_order_id] error.";
logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
if (StringUtils.isBlank(posAmountStr)) {
String errMessage = "request params[pos_amount] error.";
logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
String verifyType = WxPayConstant.VERIFY_TYPE_PAY;
return posService.checkCouponOrderForPayVerify(user, verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr);
} }


@ApiOperation(value = "券预核销")
@ApiOperation(value = "会员支付-3-券预核销", notes = "{\"coupon_order_id\":\"string(必填)\",\"deduct_amount\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}")
@PostMapping("couponOrderPreVerify") @PostMapping("couponOrderPreVerify")
public ResultData couponOrderPreVerify(@RequestBody Map<String, String> params) { public ResultData couponOrderPreVerify(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser(); WxMerchantBUser user = getUser();
String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID
String deductAmountStr = params.get(WxPayConstant.DEDUCT_AMOUNT); // 扣减金额
String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID
String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分) String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分)


@@ -115,6 +157,11 @@ public class PosController extends BaseController {
logger.error(errMessage); logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
} }
if (StringUtils.isBlank(deductAmountStr)) {
String errMessage = "request params[deduct_amount] error.";
logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
if (StringUtils.isBlank(posOrderIdStr)) { if (StringUtils.isBlank(posOrderIdStr)) {
String errMessage = "request params[pos_order_id] error."; String errMessage = "request params[pos_order_id] error.";
logger.error(errMessage); logger.error(errMessage);
@@ -125,10 +172,28 @@ public class PosController extends BaseController {
logger.error(errMessage); logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
} }
return posService.couponOrderPreVerify(user, couponOrderIdStr, posOrderIdStr, posAmountStr);
return posService.couponOrderPreVerify(user, couponOrderIdStr, deductAmountStr, posOrderIdStr, posAmountStr);
}


@ApiOperation(value = "会员支付-4-支付完成", notes = "{\"pos_order_id\":\"string\"}")
@PostMapping("posOrderFinished")
public ResultData posOrderFinished(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser();
String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID
if (StringUtils.isBlank(posOrderIdStr)) {
String errMessage = "request params[pos_order_id] error.";
logger.error(errMessage);
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
// 1. 获取订单信息
// 2. 获取所有的支付订单信息
// 3. 同步给FMPOS

return new ResultData();
} }


@ApiOperation(value = "券预核销取消")
@ApiOperation(value = "会员支付-10-券预核销取消", notes = "{\"coupon_order_id\":\"string(必填)\",\"pos_order_id\":\"string(必填)\",\"pos_amount\":\"string(必填)\"}")
@PostMapping("couponOrderPreVerifyCancel") @PostMapping("couponOrderPreVerifyCancel")
public ResultData couponOrderPreVerifyCancel(@RequestBody Map<String, String> params) { public ResultData couponOrderPreVerifyCancel(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser(); WxMerchantBUser user = getUser();
@@ -154,28 +219,4 @@ public class PosController extends BaseController {
return posService.couponOrderPreVerifyCancel(user, couponOrderIdStr, posOrderIdStr, posAmountStr); return posService.couponOrderPreVerifyCancel(user, couponOrderIdStr, posOrderIdStr, posAmountStr);
} }


@ApiOperation(value = "券独立核销", notes = "{\"couponOrderId\":\"string\", \"payment\":\"string(单位:分)\"}")
@PostMapping("posVerifyIndepent")
public ResultData posVerifyIndepent(@RequestBody Map<String, String> params) {
WxMerchantBUser user = getUser();
String couponOrderId = params.get("coupon_order_id");
String payment = params.get("payment");
if (StringUtils.isBlank(couponOrderId)) {
String errMessage = "券ID为空";
logger.error(errMessage);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}
return posService.posVerifyIndepent(user, couponOrderId, payment);
}

@ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}")
@PostMapping("verifyForPos")
public ResultData verifyForPos(@RequestBody Map<String, String> paramMap) {
// 0. 获取dev信息, tenantId信息
// 1. check 查询
// 2. create order
// 3. 独立核销

return new ResultData();
}
} }

+ 15
- 7
mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java Прегледај датотеку

@@ -1,8 +1,7 @@
package com.iformall.controller; package com.iformall.controller;


import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.service.PosBrunService;
import com.iformall.service.PosPayOrderService;
import com.iformall.domain.po.WxMerchantBUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -41,9 +40,10 @@ public class PosOrderController extends BaseController {
return new ResultData(page); return new ResultData(page);
} }


@ApiOperation("新增POS订单接口")
@PostMapping("add")
@ApiOperation(value = "新增POS订单接口", notes = "")
@PostMapping("addForPosPay")
public ResultData add(@RequestBody PosOrder posOrder) { public ResultData add(@RequestBody PosOrder posOrder) {
WxMerchantBUser user = getUser();
if (posOrder == null) { if (posOrder == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
} }
@@ -52,13 +52,21 @@ public class PosOrderController extends BaseController {
logger.error(errMessage); logger.error(errMessage);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
} }
if (posOrder.getBuUserId() == null) {
String errMessage = "操作员为空";
if (posOrder.getPaymentType() == null) {
String errMessage = "支付类型为空";
logger.error(errMessage); logger.error(errMessage);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
} }
if (posOrder.getPayment() == null) {
String errMessage = "支付金额为空";
logger.error(errMessage);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage);
}

posOrder.setTenantId(user.getTenantId());
posOrder.setBuUserId(user.getId());
posOrderService.saveOrUpdate(posOrder); posOrderService.saveOrUpdate(posOrder);
return new ResultData();
return new ResultData(posOrder);
} }


@ApiOperation("根据id更新接口") @ApiOperation("根据id更新接口")


+ 113
- 8
mallinkBApi/src/main/java/com/iformall/service/PosBrunService.java Прегледај датотеку

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


import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.Result; import com.iformall.common.Result;
@@ -8,9 +9,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.PosOrder; import com.iformall.domain.po.PosOrder;
import com.iformall.domain.po.PosPayOrder; import com.iformall.domain.po.PosPayOrder;
import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.enums.EnumPosOrderStatus;
import com.iformall.enums.EnumPosOrderType;
import com.iformall.enums.EnumPosPayType;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException; import com.iformall.exception.MallinkException;
import com.iformall.pay.WxPayConstant; import com.iformall.pay.WxPayConstant;
import com.iformall.pay.WxPayment; import com.iformall.pay.WxPayment;
@@ -23,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;


import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;


@Service @Service
@@ -228,7 +228,7 @@ public class PosBrunService {
} }


/** /**
* 券独立核销检查
* 券交易核销检查
* @param user * @param user
* @param verifyType * @param verifyType
* @param couponOrderIdStr * @param couponOrderIdStr
@@ -236,14 +236,14 @@ public class PosBrunService {
* @param posAmountStr * @param posAmountStr
* @return * @return
*/ */
public ResultData checkCouponOrderForVerify(WxMerchantBUser user,
public ResultData checkCouponOrderForPayVerify(WxMerchantBUser user,
String verifyType, String verifyType,
String couponOrderIdStr, String couponOrderIdStr,
String posOrderIdStr, String posAmountStr) { String posOrderIdStr, String posAmountStr) {
try { try {
String resStr = posUtil.checkCouponOrderForVerify(posUrl, posDevId, posReqKey, String resStr = posUtil.checkCouponOrderForVerify(posUrl, posDevId, posReqKey,
user.getTenantId(), String.valueOf(user.getMerchantId()), String.valueOf(user.getId()), user.getTenantId(), String.valueOf(user.getMerchantId()), String.valueOf(user.getId()),
couponOrderIdStr, verifyType, posOrderIdStr, posAmountStr);
verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr);
if (resStr != null) { if (resStr != null) {
JSONObject retObj = JSON.parseObject(resStr); JSONObject retObj = JSON.parseObject(resStr);
Map options = retObj; Map options = retObj;
@@ -273,8 +273,44 @@ public class PosBrunService {
* @return * @return
*/ */
public ResultData couponOrderPreVerify(WxMerchantBUser user, public ResultData couponOrderPreVerify(WxMerchantBUser user,
String couponOrderIdStr,
String couponOrderIdStr, String deductAmountStr,
String posOrderIdStr, String posAmountStr) { String posOrderIdStr, String posAmountStr) {
Integer deductAmount, posAmount;
Long posOrderId;
try {
deductAmount = Integer.valueOf(deductAmountStr);
posAmount = Integer.valueOf(posAmountStr);
posOrderId = Long.valueOf(posOrderIdStr);
} catch (NumberFormatException e) {
logger.error(ErrorCode.SYS_PARAMETER_CAST_ERROR.getMessage());
return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR);
}
// 1. 创建支付订单
Date curDate = new Date();
PosPayOrder posPayOrder = new PosPayOrder();
posPayOrder.setTenantId(user.getTenantId());
posPayOrder.setCreateTime(curDate);
posPayOrder.setUpdateTime(curDate);
posPayOrder.setOrderId(posOrderId);
posPayOrder.setBuUserId(user.getId());
posPayOrder.setType(2);
posPayOrder.setPayFrom(10);
posPayOrder.setPayAmount(deductAmount);
posPayOrder.setPayTimeStart(curDate);
posPayOrder.setPayTimeEnd(curDate);
posPayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode());
posPayOrder.setShare(0);
try {
posPayOrderService.saveOrUpdate(posPayOrder);
} catch (MallinkException e) {
logger.error(e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
return new ResultData(Result.ERROR, e.getMessage());
}

// 2. POS预核销
try { try {
String resStr = posUtil.couponOrderPreVerify(posUrl, posDevId, posReqKey, String resStr = posUtil.couponOrderPreVerify(posUrl, posDevId, posReqKey,
user.getTenantId(), String.valueOf(user.getMerchantId()), String.valueOf(user.getId()), user.getTenantId(), String.valueOf(user.getMerchantId()), String.valueOf(user.getId()),
@@ -285,7 +321,65 @@ public class PosBrunService {
if (!WxPayment.verifyNotifyHMAC(options, posResKey)) { if (!WxPayment.verifyNotifyHMAC(options, posResKey)) {
return new ResultData(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); return new ResultData(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR);
} else { } else {
return new ResultData(resStr);
if (retObj.getString(WxPayConstant.RETURN_CODE).equalsIgnoreCase(WxPayConstant.RET_SUCCESS) &&
retObj.getString(WxPayConstant.RESULT_CODE).equalsIgnoreCase(WxPayConstant.RET_SUCCESS)) {
Integer remainAmount = posAmount;
// 获取 返回值
JSONArray retArr = retObj.getJSONArray(WxPayConstant.RET);
for (int i = 0; i > retArr.size(); i++) {
JSONObject couponObj = retArr.getJSONObject(i);
if (couponObj == null) {
continue;
}
String deductAmountOfCouponStr = couponObj.getString(WxPayConstant.DEDUCT_AMOUNT);
Integer deductAmountofCoupon = Integer.valueOf(deductAmountOfCouponStr);
// 新 支付订单状态
PosPayOrder updatePayOrder = new PosPayOrder();
updatePayOrder.setId(Long.valueOf(couponObj.getLong(WxPayConstant.ID)));
updatePayOrder.setPayAmount(deductAmountofCoupon);
updatePayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode());
updatePayOrder.setPayTimeEnd(new Date());
try {
posPayOrderService.saveOrUpdate(updatePayOrder);
} catch (MallinkException e) {
logger.error(e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
return new ResultData(Result.ERROR, e.getMessage());
}
String remainAmountStr = couponObj.getString(WxPayConstant.REMAIN_AMOUNT);
Integer remainAmountofCoupon = Integer.valueOf(remainAmountStr);
remainAmount = remainAmountofCoupon;
}
// 更新 订单状态
PosOrder updateOrder = new PosOrder();
updateOrder.setId(posOrderId);
updateOrder.setRemainAmount(remainAmount);
updateOrder.setUpdateDate(new Date());
if (remainAmount.equals(0)) {
updateOrder.setOrderStatus(EnumPosOrderStatus.PAYMENT_SUCCESS.getCode());
retObj.put(WxPayConstant.ORDER_STATUS, EnumPosOrderStatus.PAYMENT_SUCCESS.getCode());
retObj.put(WxPayConstant.DEDUCT_AMOUNT, 0);
} else {
updateOrder.setOrderStatus(EnumPosOrderStatus.PENDING.getCode());
retObj.put(WxPayConstant.ORDER_STATUS, EnumPosOrderStatus.PENDING.getCode());
retObj.put(WxPayConstant.DEDUCT_AMOUNT, remainAmount);
}
try {
posOrderService.saveOrUpdate(updateOrder);
} catch (MallinkException e) {
logger.error(e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
return new ResultData(Result.ERROR, e.getMessage());
}
return new ResultData(JSON.toJSONString(retObj));
} else {
logger.error(resStr);
return new ResultData(Result.ERROR, retObj.getString(WxPayConstant.ERR_CODE_DESC));
}
} }
} else { } else {
return new ResultData(Result.ERROR, "无返回值"); return new ResultData(Result.ERROR, "无返回值");
@@ -446,6 +540,17 @@ public class PosBrunService {
logger.error(e.getMessage()); logger.error(e.getMessage());
return new ResultData(Result.ERROR, e.getMessage()); return new ResultData(Result.ERROR, e.getMessage());
} }
// 5. 同步给fm pos进程
// 5.1 posOrder信息
PosOrder syncOrder = posOrderService.getById(posOrder.getId());
if (syncOrder != null) {
// 5.2 posPayOrder信息
PosPayOrder q = new PosPayOrder();
q.setOrderId(posOrder.getId());
List<PosPayOrder> posPayOrders = posPayOrderService.getList(q);

}

return new ResultData(); return new ResultData();
} }
} }

+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/PosOrder.java Прегледај датотеку

@@ -33,6 +33,8 @@ public class PosOrder implements Serializable {
private Integer paymentType; private Integer paymentType;
@io.swagger.annotations.ApiModelProperty(value="支付金额:允许有负数,退款时为负值。核销时,金额可以不填写",name="paymentType") @io.swagger.annotations.ApiModelProperty(value="支付金额:允许有负数,退款时为负值。核销时,金额可以不填写",name="paymentType")
private Integer payment; private Integer payment;
@io.swagger.annotations.ApiModelProperty(value="支付剩余金额",name="remainAmount")
private Integer remainAmount;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate; private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")


+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java Прегледај датотеку

@@ -140,4 +140,7 @@ public class WxBillAll extends BaseEntity {
@Transient @Transient
private Integer balance; private Integer balance;


@io.swagger.annotations.ApiModelProperty(value = "多个类型", name = "typeStr")
private String typeStr;

} }

+ 12
- 8
mallinkService/src/main/java/com/iformall/enums/EnumPosOrderStatus.java Прегледај датотеку

@@ -8,15 +8,19 @@ package com.iformall.enums;
public enum EnumPosOrderStatus { public enum EnumPosOrderStatus {


PENDING_PAYMENT(0, "待付款"), PENDING_PAYMENT(0, "待付款"),
PAYMENT_SUCCESS(1, "已支付"),
OVERTIME_CANCEL(2, "已取消"),
PENDING_REFUND(3, "待退款"),
REFUND_SUCCESS(4,"已退款"),
REFUND_FAILD(5, "退款失败"),
PENDING(1, "支付中"),
PAYMENT_SUCCESS(2, "已支付"),
OVERTIME_CANCEL(3, "已取消"),
PENDING_REFUND(4, "待退款"),
REFUNDING(5, "退款中"),
REFUND_SUCCESS(6,"已退款"),
REFUND_FAILD(7, "退款失败"),
PENDING_VERIFY(10, "待核销"), PENDING_VERIFY(10, "待核销"),
VERIFY_SUCCESS(11, "已核销"),
VERIFY_CANCEL(12, "核销待退"),
VERIFY_CANCELED(13, "核销已退")
VERIFING(11, "核销中"),
VERIFY_SUCCESS(12, "已核销"),
VERIFY_CANCEL(13, "核销待退"),
VERIFY_CANCELING(14, "核销退中"),
VERIFY_CANCELED(15, "核销已退")
; ;






+ 1
- 0
mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java Прегледај датотеку

@@ -64,6 +64,7 @@ public class WxPayConstant {


public final static String DEDUCT_AMOUNT = "deduct_amount"; public final static String DEDUCT_AMOUNT = "deduct_amount";
public final static String REMAIN_AMOUNT = "remain_amount"; public final static String REMAIN_AMOUNT = "remain_amount";
public final static String ORDER_STATUS = "order_status";


public final static String REAL_AMOUNT = "real_amount"; public final static String REAL_AMOUNT = "real_amount";
public final static String SALE_PRICE = "sale_price"; public final static String SALE_PRICE = "sale_price";


+ 10
- 1
mallinkService/src/main/java/com/iformall/service/PosPayOrderService.java Прегледај датотеку

@@ -1,9 +1,10 @@
package com.iformall.service; package com.iformall.service;


import java.util.*;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PosPayOrder; import com.iformall.domain.po.PosPayOrder;


import java.util.List;

public interface PosPayOrderService { public interface PosPayOrderService {


/** /**
@@ -15,6 +16,14 @@ public interface PosPayOrderService {
* @return * @return
*/ */
PageInfo<PosPayOrder> listAsPage(PosPayOrder record, Integer pageIndex, Integer pageSize); PageInfo<PosPayOrder> listAsPage(PosPayOrder record, Integer pageIndex, Integer pageSize);

/**
* 根据实体查询列表
*
* @param record
* @return
*/
List<PosPayOrder> getList(PosPayOrder record);
/** /**
* 根据Id获得实体 * 根据Id获得实体


+ 4
- 0
mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java Прегледај датотеку

@@ -31,6 +31,10 @@ public class PosOrderServiceImpl implements PosOrderService {
if (record.getId() == null) { if (record.getId() == null) {
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId()); record.setId(idWorker.nextId());
record.setPosOrderNo(String.valueOf(record.getId()));
if (record.getPayment() != null) {
record.setRemainAmount(record.getPayment());
}
posOrderMapper.insertSelective(record); posOrderMapper.insertSelective(record);
} else { } else {
posOrderMapper.updateByPrimaryKeySelective(record); posOrderMapper.updateByPrimaryKeySelective(record);


+ 6
- 0
mallinkService/src/main/java/com/iformall/service/impl/PosPayOrderServiceImpl.java Прегледај датотеку

@@ -22,6 +22,11 @@ public class PosPayOrderServiceImpl implements PosPayOrderService {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> posPayOrderMapper.findList(record)); return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> posPayOrderMapper.findList(record));
} }


@Override
public List<PosPayOrder> getList(PosPayOrder record) {
return posPayOrderMapper.findList(record);
}

@Override @Override
public PosPayOrder getById(Long id) { public PosPayOrder getById(Long id) {
return posPayOrderMapper.selectByPrimaryKey(id); return posPayOrderMapper.selectByPrimaryKey(id);
@@ -33,6 +38,7 @@ public class PosPayOrderServiceImpl implements PosPayOrderService {
//record.setId(UUID.randomUUID().toString().replaceAll("-", "")); //record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId()); record.setId(idWorker.nextId());
record.setPayOrderNo(String.valueOf(record.getId()));
posPayOrderMapper.insertSelective(record); posPayOrderMapper.insertSelective(record);
} else { } else {
posPayOrderMapper.updateByPrimaryKeySelective(record); posPayOrderMapper.updateByPrimaryKeySelective(record);


+ 6
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java Прегледај датотеку

@@ -1,5 +1,6 @@
package com.iformall.service.impl; package com.iformall.service.impl;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@@ -120,13 +121,17 @@ public class WxBillAllServiceImpl implements WxBillAllService {
public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) {
//更新各账单状态 //更新各账单状态
//updateBillStatus(record); //updateBillStatus(record);

if (StringUtils.isNotEmpty(record.getTypeStr())) {
List<Integer> typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class);
record.setTypeList(typeList);
}
PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record));


Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("pageInfo", pageInfo); result.put("pageInfo", pageInfo);
return result; return result;
} }

@Override @Override
public List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll) { public List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll) {
//更新各账单状态 //更新各账单状态


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java Прегледај датотеку

@@ -178,6 +178,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService {
wxBillDaily.setPayDate(record.getPayDate()); wxBillDaily.setPayDate(record.getPayDate());
wxBillDaily.setUpdatetime(date); wxBillDaily.setUpdatetime(date);
wxBillDaily.setPayWay(record.getPayWay()); wxBillDaily.setPayWay(record.getPayWay());
wxBillDaily.setPriceDetail(record.getPriceDetail());
try { try {
wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily);
} catch (Exception e) { } catch (Exception e) {


+ 4
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java Прегледај датотеку

@@ -283,11 +283,11 @@ public class WxBillRentServiceImpl implements WxBillRentService {
wxBillRent.setRevenue(record.getRevenue()); wxBillRent.setRevenue(record.getRevenue());


Integer ratio = 0; Integer ratio = 0;
if(wxRentContract.getPayRatio() != null){
if(wxRentContract.getPayRatio() != null && wxRentContract.getPayRatio().intValue() > 0){
ratio = wxRentContract.getPayRatio(); ratio = wxRentContract.getPayRatio();
}else{ }else{
if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){
long dayCount = DateUtils.startToEnd(record.getStarttime(),record.getEndtime());
long dayCount = DateUtils.startToEnd(wxBillRent.getStarttime(),wxBillRent.getEndtime());
if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){
if(startInt == endInt && months == 12){ if(startInt == endInt && months == 12){
//刚好1年 //刚好1年
@@ -319,17 +319,13 @@ public class WxBillRentServiceImpl implements WxBillRentService {


Long oldPrice = wxBillRent.getReceivePay(); Long oldPrice = wxBillRent.getReceivePay();
Long newPrice = newReceivePay; Long newPrice = newReceivePay;
//wxBillRent.setReceivePay(oldPrice.equals(newPrice) ? oldPrice : newPrice);
wxBillRent.setUpdatetime(new Date()); wxBillRent.setUpdatetime(new Date());


//如果在跳点区间中,修改扣点率 //如果在跳点区间中,修改扣点率

wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent);
if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){
wxRentContract.setPayRatio(ratio);
wxRentContract.setUpdatetime(new Date());
wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract);
wxBillRent.setPayRatio(new Long(ratio));
} }
wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent);


if (!oldPrice.equals(newPrice)) { if (!oldPrice.equals(newPrice)) {
//日志 //日志


+ 13
- 14
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Прегледај датотеку

@@ -258,10 +258,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if(StringUtils.isBlank(busDiscountRatio)){ if(StringUtils.isBlank(busDiscountRatio)){
return ratioVo; return ratioVo;
} }
BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(4, RoundingMode.HALF_EVEN);
List<String> ratioList = JSONArray.parseArray(busDiscountRatio, String.class); List<String> ratioList = JSONArray.parseArray(busDiscountRatio, String.class);


for (int i = 0; i < ratioList.size(); i++) { for (int i = 0; i < ratioList.size(); i++) {
BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(4, RoundingMode.HALF_EVEN);
String e = ratioList.get(i); String e = ratioList.get(i);
String[] array = e.split(":"); String[] array = e.split(":");
Integer ratio = Integer.parseInt(array[1]); Integer ratio = Integer.parseInt(array[1]);
@@ -278,7 +278,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount));
} }
if(EnumGetRatioFrom.RENT.getCode().equals(from)) { if(EnumGetRatioFrom.RENT.getCode().equals(from)) {
revenue = revenue.divide(new BigDecimal(12));
revenue = revenue.multiply(new BigDecimal(12));
} }
}else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){
if(EnumGetRatioFrom.BILL.getCode().equals(from)) { if(EnumGetRatioFrom.BILL.getCode().equals(from)) {
@@ -287,7 +287,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
}else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){
if(EnumGetRatioFrom.RENT.getCode().equals(from)) { if(EnumGetRatioFrom.RENT.getCode().equals(from)) {
revenue = revenue.divide(new BigDecimal(period));
revenue = revenue.multiply(new BigDecimal(period));
} }
} }


@@ -305,7 +305,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount)); end = new BigDecimal(revenueArray[1]).divide(new BigDecimal(365), 10, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(dayCount));
} }
if(EnumGetRatioFrom.RENT.getCode().equals(from)) { if(EnumGetRatioFrom.RENT.getCode().equals(from)) {
revenue = revenue.divide(new BigDecimal(12));
revenue = revenue.multiply(new BigDecimal(12));
} }
}else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){
if(EnumGetRatioFrom.BILL.getCode().equals(from)) { if(EnumGetRatioFrom.BILL.getCode().equals(from)) {
@@ -313,7 +313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
}else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){
if(EnumGetRatioFrom.RENT.getCode().equals(from)) { if(EnumGetRatioFrom.RENT.getCode().equals(from)) {
revenue = revenue.divide(new BigDecimal(period));
revenue = revenue.multiply(new BigDecimal(period));
} }
} }


@@ -322,7 +322,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {


//计算超出部分 //计算超出部分
BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000));
BigDecimal balance = new BigDecimal(revenueLong).subtract(end.multiply(new BigDecimal(1000000)));
BigDecimal balance = revenue.subtract(end).multiply(new BigDecimal(1000000));
BigDecimal price = balance.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); BigDecimal price = balance.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);


array = ratioList.get(i-1).split(":"); array = ratioList.get(i-1).split(":");
@@ -378,17 +378,17 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if(record.getRevenue() == null || record.getRevenue().longValue() <= 0){ if(record.getRevenue() == null || record.getRevenue().longValue() <= 0){
record.setPrice(0l); record.setPrice(0l);
}else{ }else{
if(record.getPayRatio()!=null){
if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){
record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); record.setPrice(countPrice(record.getPayRatio(),record.getRevenue()));
}else{ }else{
int dayCount = record.getReceivePeriod() * 30; int dayCount = record.getReceivePeriod() * 30;
RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod());
record.setPayRatio(ratioVo.getRatio());
//record.setPayRatio(ratioVo.getRatio());
if(ratioVo.getBalance() != null){ if(ratioVo.getBalance() != null){
//有超出部分,在getPayRatio里计算 //有超出部分,在getPayRatio里计算
record.setPrice(ratioVo.getBalance().longValue()); record.setPrice(ratioVo.getBalance().longValue());
}else{ }else{
record.setPrice(countPrice(record.getPayRatio(),record.getRevenue()));
record.setPrice(countPrice(ratioVo.getRatio(),record.getRevenue()));
} }
} }
} }
@@ -597,8 +597,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRentMapper.insertBills(record.getPreviewBillRentList()); wxBillRentMapper.insertBills(record.getPreviewBillRentList());
} }




public ResultData getResultDataForUpdate(WxRentContract record, Long userId,int from,Date oldRentStartDate) { public ResultData getResultDataForUpdate(WxRentContract record, Long userId,int from,Date oldRentStartDate) {
//更新租赁合同信息 //更新租赁合同信息
WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId());
@@ -607,6 +605,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
wxRentContract.setBusDiscountTime(record.getBusDiscountTime()); wxRentContract.setBusDiscountTime(record.getBusDiscountTime());
wxRentContract.setBusDiscountRatio(record.getBusDiscountRatio()); wxRentContract.setBusDiscountRatio(record.getBusDiscountRatio());
wxRentContract.setPayRatio(record.getPayRatio());


int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH;


@@ -617,17 +616,17 @@ public class WxRentContractServiceImpl implements WxRentContractService {


if(!EnumFromType.SWITCH.getCode().equals(from)){ if(!EnumFromType.SWITCH.getCode().equals(from)){
if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if(record.getPayRatio()!=null){
if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){
record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); record.setPrice(countPrice(record.getPayRatio(),record.getRevenue()));
}else{ }else{
int dayCount = record.getReceivePeriod() * 30; int dayCount = record.getReceivePeriod() * 30;
RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod());
record.setPayRatio(ratioVo.getRatio());
//record.setPayRatio(ratioVo.getRatio());
if(ratioVo.getBalance() != null){ if(ratioVo.getBalance() != null){
//有超出部分,在getPayRatio里计算 //有超出部分,在getPayRatio里计算
record.setPrice(ratioVo.getBalance().longValue()); record.setPrice(ratioVo.getBalance().longValue());
}else{ }else{
record.setPrice(countPrice(record.getPayRatio(),record.getRevenue()));
record.setPrice(countPrice(ratioVo.getRatio(),record.getRevenue()));
} }
} }
} else { } else {


+ 24
- 10
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml Прегледај датотеку

@@ -99,7 +99,7 @@
<if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if> <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if>
<if test=" null != status ">and bill.`status` = #{status}</if> <if test=" null != status ">and bill.`status` = #{status}</if>
<if test=" null != rentShopType ">and bill.rent_shop_type = #{rentShopType}</if> <if test=" null != rentShopType ">and bill.rent_shop_type = #{rentShopType}</if>
<if test=" null != starttime and null!= endtime ">
<if test=" null != starttime and null!= endtime and '' != starttime and ''!= endtime ">
and bill.receive_date between #{starttime} and #{endtime} and bill.receive_date between #{starttime} and #{endtime}
</if> </if>
<if test=" null != merchantId and ''!=merchantId"> <if test=" null != merchantId and ''!=merchantId">
@@ -111,6 +111,14 @@
#{status} #{status}
</foreach> </foreach>
</if> </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 != sortColumns"> order by ${sortColumns} </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> <if test=" null == sortColumns"> order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status</if>


@@ -227,26 +235,30 @@
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.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,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus, bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus,
pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount,bill.rent_shop_type pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount,bill.rent_shop_type
rentShopType from (
rentShopType,bill.price_detail priceDetail from (
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_rent where is_preview = 0 and tenant_id=#{tenantId} and rent_contract_id in (select id from from wx_bill_rent where is_preview = 0 and tenant_id=#{tenantId} and rent_contract_id in (select id from
wx_rent_contract where status in wx_rent_contract where status in
(2,3,4)) (2,3,4))
union all union all
select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_rent_deposit where tenant_id=#{tenantId} and rent_contract_id in (select id from wx_rent_contract from wx_bill_rent_deposit where tenant_id=#{tenantId} and rent_contract_id in (select id from wx_rent_contract
where status in (2,3,4)) where status in (2,3,4))
union all union all
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_property where is_preview = 0 and tenant_id=#{tenantId} and property_contract_id in (select id from from wx_bill_property where is_preview = 0 and tenant_id=#{tenantId} and property_contract_id in (select id from
wx_property_contract wx_property_contract
where status in(2,3,4)) where status in(2,3,4))
union all union all
select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_property_deposit where tenant_id=#{tenantId} and property_contract_id in (select id from from wx_bill_property_deposit where tenant_id=#{tenantId} and property_contract_id in (select id from
wx_property_contract where status in wx_property_contract where status in
(2,3,4)) (2,3,4))
@@ -254,15 +266,17 @@
select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, select id,merchant_id,shop_id,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 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, 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
pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,price_detail
from wx_bill_daily where tenant_id=#{tenantId} from wx_bill_daily where tenant_id=#{tenantId}
union all union all
select id,merchant_id,shop_id,tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as select id,merchant_id,shop_id,tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,''
price_detail
from wx_bill_other where tenant_id=#{tenantId} from wx_bill_other where tenant_id=#{tenantId}
union all union all
select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,''
price_detail
from wx_bill_other_deposit where tenant_id=#{tenantId} from wx_bill_other_deposit where tenant_id=#{tenantId}
) bill ) bill
left join wx_merchant m on bill.merchant_id=m.id left join wx_merchant m on bill.merchant_id=m.id
@@ -291,7 +305,7 @@
#{type} #{type}
</foreach> </foreach>
</if> </if>
<if test="null!=starttime and null!=endtime">
<if test="null!=starttime and null!=endtime and ''!=starttime and ''!=endtime ">
and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime} and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime}
</if> </if>
<if test=" null != status "> <if test=" null != status ">


+ 1
- 1
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Прегледај датотеку

@@ -97,7 +97,7 @@
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name, case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name,
s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type, s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type,
r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`,
br.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`,
d.receive_pay deposit,d.`status` d.receive_pay deposit,d.`status`
deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime,
r.late_pay_day,r.late_pay_ratio r.late_pay_day,r.late_pay_ratio


Loading…
Откажи
Сачувај