修改
This commit is contained in:
@@ -3,8 +3,6 @@ package com.chaozhanggui.system.cashierservice.service;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.chaozhanggui.system.cashierservice.bean.TableStateEnum;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
@@ -20,8 +18,6 @@ import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp
|
||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
||||
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -87,6 +83,7 @@ public class MemberService {
|
||||
@Qualifier("tbOrderInfoMapper")
|
||||
@Autowired
|
||||
private TbOrderInfoMapper tbOrderInfoMapper;
|
||||
private MpShopTableMapper mpShopTableMapper;
|
||||
|
||||
public Result queryMember(String shopId, String phone, int page, int pageSize) {
|
||||
|
||||
@@ -316,7 +313,6 @@ public class MemberService {
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, memberIn);
|
||||
} else {
|
||||
String status = ObjectUtil.isNotEmpty(object.getJSONObject("data")) ? object.getJSONObject("data").getString("status") : null;
|
||||
@@ -399,7 +395,6 @@ public class MemberService {
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
|
||||
JSONObject baObj = new JSONObject();
|
||||
baObj.put("userId", shopUser.getUserId());
|
||||
baObj.put("shopId", shopInfo.getId());
|
||||
@@ -410,8 +405,6 @@ public class MemberService {
|
||||
producer.balance(baObj.toString());
|
||||
|
||||
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, memberIn);
|
||||
|
||||
} else if ("TRADE_AWAIT".equals(mainScanResp.getState())) {
|
||||
@@ -432,7 +425,6 @@ public class MemberService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Result queryScanPay(String flowId, String token) {
|
||||
if (ObjectUtil.isEmpty(flowId)) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
@@ -579,7 +571,6 @@ public class MemberService {
|
||||
return Result.success(CodeEnum.SUCCESS, memberIn);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result memberAccountPay(Map<String, Object> map, String token) throws Exception {
|
||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0
|
||||
@@ -592,7 +583,6 @@ public class MemberService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
String memberId = String.valueOf(map.get("memberId"));
|
||||
|
||||
String shopId = String.valueOf(map.get("shopId"));
|
||||
@@ -709,7 +699,6 @@ public class MemberService {
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
|
||||
JSONObject baObj = new JSONObject();
|
||||
baObj.put("userId", shopUser.getUserId());
|
||||
baObj.put("shopId", shopInfo.getId());
|
||||
@@ -720,14 +709,9 @@ public class MemberService {
|
||||
producer.balance(baObj.toString());
|
||||
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
private MpShopTableMapper mpShopTableMapper;
|
||||
|
||||
|
||||
|
||||
public Result queryMemberAccount(String memberId, int page, int pageSize) {
|
||||
if (ObjectUtil.isEmpty(memberId)) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
@@ -760,27 +744,39 @@ public class MemberService {
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
BigDecimal amount=BigDecimal.ZERO;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if(N.gt(flow.getAmount(),user.getAmount())){
|
||||
return Result.fail(CodeEnum.ACCOUNTAMOUNT);
|
||||
amount=user.getAmount();
|
||||
}else {
|
||||
amount=flow.getAmount();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getShopId()));
|
||||
if (ObjectUtil.isEmpty(shopInfo) || ObjectUtil.isNull(shopInfo)) {
|
||||
return Result.fail(CodeEnum.MERCHANTEIXST);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ("scanMemberIn".equals(flow.getBizCode())) {
|
||||
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
||||
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||
return Result.fail(CodeEnum.NOCUSTOMER);
|
||||
}
|
||||
|
||||
|
||||
if("scanMemberIn".equals(flow.getBizCode())) {
|
||||
|
||||
String no = DateUtils.getSsdfTimes();
|
||||
|
||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(),no , null, flow.getRemark(), "充值退款", flow.getAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), no, null, flow.getRemark(), "充值退款",amount.setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||
if ("000000".equals(publicResp.getCode())) {
|
||||
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
|
||||
@@ -797,7 +793,7 @@ public class MemberService {
|
||||
} else {
|
||||
return Result.fail(CodeEnum.OPARETIONERROR);
|
||||
}
|
||||
user.setAmount(user.getAmount().subtract(flow.getAmount()));
|
||||
user.setAmount(user.getAmount().subtract(amount));
|
||||
user.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(user);
|
||||
|
||||
@@ -806,11 +802,10 @@ public class MemberService {
|
||||
tbShopUserFlowMapper.updateByPrimaryKey(flow);
|
||||
|
||||
|
||||
|
||||
JSONObject baObj = new JSONObject();
|
||||
baObj.put("userId", user.getUserId());
|
||||
baObj.put("shopId", user.getId());
|
||||
baObj.put("amount",flow.getAmount());
|
||||
baObj.put("amount", amount);
|
||||
baObj.put("balance", user.getAmount());
|
||||
baObj.put("type", "退款");
|
||||
baObj.put("time", new Date());
|
||||
@@ -821,17 +816,4 @@ public class MemberService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user