This commit is contained in:
parent
3a185c4d59
commit
445551f0d5
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.chaozhanggui.system.cashierservice.bean.TableStateEnum;
|
import com.chaozhanggui.system.cashierservice.bean.TableStateEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.model.ScanPayReq;
|
import com.chaozhanggui.system.cashierservice.model.ScanPayReq;
|
||||||
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
||||||
import com.chaozhanggui.system.cashierservice.mybatis.MpShopTableMapper;
|
import com.chaozhanggui.system.cashierservice.mybatis.MpShopTableMapper;
|
||||||
|
|
@ -14,6 +15,7 @@ import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.MainScanResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.MainScanResp;
|
||||||
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderReturnResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
||||||
|
|
@ -331,7 +333,7 @@ public class MemberService {
|
||||||
|
|
||||||
String orderNo = DateUtils.getSsdfTimes();
|
String orderNo = DateUtils.getSsdfTimes();
|
||||||
|
|
||||||
PublicResp<MainScanResp> publicResp = thirdPayService.mainScan(url, thirdApply.getAppId(), "会员充值", "会员充值", amount.setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), wechatpay.equals("wxpay") ? thirdApply.getSmallAppid() : null, authCode, DateUtils.getSsdfTimes(), thirdApply.getStoreId(), callBack, thirdApply.getAppToken());
|
PublicResp<MainScanResp> publicResp = thirdPayService.mainScan(url, thirdApply.getAppId(), "会员充值", "会员充值", amount.setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), wechatpay.equals("wxpay") ? thirdApply.getSmallAppid() : null, authCode, orderNo, thirdApply.getStoreId(), callBack, thirdApply.getAppToken());
|
||||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||||
if ("000000".equals(publicResp.getCode())) {
|
if ("000000".equals(publicResp.getCode())) {
|
||||||
MainScanResp mainScanResp = publicResp.getObjData();
|
MainScanResp mainScanResp = publicResp.getObjData();
|
||||||
|
|
@ -355,6 +357,7 @@ public class MemberService {
|
||||||
flow.setAmount(amount);
|
flow.setAmount(amount);
|
||||||
flow.setBalance(shopUser.getAmount());
|
flow.setBalance(shopUser.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
|
flow.setRemark(orderNo);
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
|
|
||||||
BigDecimal fl=null;
|
BigDecimal fl=null;
|
||||||
|
|
@ -761,24 +764,26 @@ public class MemberService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if("scanMemberIn".equals(flow.getBizCode())){
|
if("scanMemberIn".equals(flow.getBizCode())) {
|
||||||
PublicResp<OrderStatusQueryResp> orderstatus = thirdPayService.queryOrder(url, thirdApply.getAppId(),flow.getAmount().toPlainString(), null, thirdApply.getAppToken());
|
|
||||||
if (ObjectUtil.isNotNull(orderstatus) && ObjectUtil.isNotEmpty(orderstatus)) {
|
|
||||||
if ("000000".equals(orderstatus.getCode())) {
|
|
||||||
if ("TRADE_SUCCESS".equals(orderstatus.getObjData().getState())) {
|
|
||||||
user.setAmount(user.getAmount().subtract(flow.getAmount()));
|
|
||||||
user.setUpdatedAt(System.currentTimeMillis());
|
|
||||||
tbShopUserMapper.updateByPrimaryKey(user);
|
|
||||||
|
|
||||||
flow.setIsReturn("1");
|
String no=DateUtils.getSsdfTimes();
|
||||||
flow.setRemark(remark);
|
|
||||||
tbShopUserFlowMapper.updateByPrimaryKey(flow);
|
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(),no , flow.getRemark(), null, "充值退款", flow.getAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||||
|
if ("000000".equals(publicResp.getCode())) {
|
||||||
|
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
|
||||||
|
MsgException.check(true, "退款渠道调用失败");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MsgException.check(true, "退款渠道调用失败");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else if("cashMemberIn".equals(flow.getBizCode())){
|
|
||||||
|
|
||||||
|
} else if ("cashMemberIn".equals(flow.getBizCode())) {
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return Result.fail(CodeEnum.OPARETIONERROR);
|
||||||
|
}
|
||||||
user.setAmount(user.getAmount().subtract(flow.getAmount()));
|
user.setAmount(user.getAmount().subtract(flow.getAmount()));
|
||||||
user.setUpdatedAt(System.currentTimeMillis());
|
user.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbShopUserMapper.updateByPrimaryKey(user);
|
tbShopUserMapper.updateByPrimaryKey(user);
|
||||||
|
|
@ -786,14 +791,12 @@ public class MemberService {
|
||||||
flow.setIsReturn("1");
|
flow.setIsReturn("1");
|
||||||
flow.setRemark(remark);
|
flow.setRemark(remark);
|
||||||
tbShopUserFlowMapper.updateByPrimaryKey(flow);
|
tbShopUserFlowMapper.updateByPrimaryKey(flow);
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
|
||||||
}else {
|
|
||||||
return Result.fail(CodeEnum.OPARETIONERROR);
|
|
||||||
}
|
}
|
||||||
return Result.fail(CodeEnum.FAIL);
|
return Result.fail(CodeEnum.FAIL);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,12 @@
|
||||||
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
|
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
|
||||||
|
<result column="is_return" jdbcType="VARCHAR" property="isReturn" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type
|
id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type,is_return,remark
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
|
@ -27,10 +30,10 @@
|
||||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
|
||||||
insert into tb_shop_user_flow (id, shop_user_id, amount,
|
insert into tb_shop_user_flow (id, shop_user_id, amount,
|
||||||
balance, biz_code, biz_name,
|
balance, biz_code, biz_name,
|
||||||
create_time, type)
|
create_time, type,is_return,remark)
|
||||||
values (#{id,jdbcType=INTEGER}, #{shopUserId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL},
|
values (#{id,jdbcType=INTEGER}, #{shopUserId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL},
|
||||||
#{balance,jdbcType=DECIMAL}, #{bizCode,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
|
#{balance,jdbcType=DECIMAL}, #{bizCode,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
|
||||||
#{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR})
|
#{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR},#{isReturn,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
|
||||||
insert into tb_shop_user_flow
|
insert into tb_shop_user_flow
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue