This commit is contained in:
parent
1bbb17503f
commit
435a0f55d1
|
|
@ -100,10 +100,10 @@ public class AccTrade extends BaseEntity {
|
|||
@ApiModelProperty(value = "批量操作批次号")
|
||||
private String batchNum;
|
||||
|
||||
/** 关联小牛订单号 */
|
||||
@Excel(name = "关联小牛订单号")
|
||||
@ApiModelProperty(value = "关联小牛订单号")
|
||||
private Long leOrdNo;
|
||||
/** 商户订单号 */
|
||||
@Excel(name = "商户订单号")
|
||||
@ApiModelProperty(value = "商户订单号")
|
||||
private String orderNo;
|
||||
|
||||
/** 关联原记录交易id */
|
||||
@Excel(name = "关联原记录交易id")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.bonus.canteen.core.pay.dto;
|
||||
package com.bonus.canteen.core.account.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
|
@ -14,14 +14,14 @@ public class AccTradeVo {
|
|||
private BigDecimal paymentAmount;//付款金额, 必填
|
||||
private String productDesc;//商品描述
|
||||
private Long amount; //金额(单位:分)
|
||||
private Integer tradeType;
|
||||
private Long tradeType;
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private Date tradeTime;
|
||||
private Integer tradeState;
|
||||
private Integer payType;
|
||||
private Integer payState; //是否付款 true - 已付 false-未付
|
||||
private Long tradeState;
|
||||
private Long payType;
|
||||
private Long payState; //是否付款 true - 已付 false-未付
|
||||
private String thirdTradeNo; //三方,支付宝交易号
|
||||
private String failReason;
|
||||
@JsonFormat(
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.account.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.account.domain.AccTrade;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccTradeVo;
|
||||
|
||||
/**
|
||||
* 账户交易记录Mapper接口
|
||||
|
|
@ -44,7 +45,7 @@ public interface AccTradeMapper {
|
|||
*/
|
||||
public int updateAccTrade(AccTrade accTrade);
|
||||
|
||||
// public int updateAccTradeVo(AccTradeVo accTrade);
|
||||
public int updateAccTradeVoByOrderNo(AccTradeVo accTradeVo);
|
||||
|
||||
/**
|
||||
* 删除账户交易记录
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.bonus.canteen.core.account.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.account.domain.AccTrade;
|
||||
import com.bonus.canteen.core.pay.dto.AccTradeVo;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccTradeVo;
|
||||
|
||||
/**
|
||||
* 账户交易记录Service接口
|
||||
|
|
@ -45,7 +45,7 @@ public interface IAccTradeService {
|
|||
*/
|
||||
public int updateAccTrade(AccTrade accTrade);
|
||||
|
||||
public int updateAccTradeVo(AccTradeVo accTrade);
|
||||
public int updateAccTradeVoByOrderNo(AccTradeVo accTrade);
|
||||
|
||||
/**
|
||||
* 批量删除账户交易记录
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.bonus.canteen.core.account.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.pay.dto.AccTradeVo;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccTradeVo;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -56,7 +56,7 @@ public class AccTradeServiceImpl implements IAccTradeService {
|
|||
try {
|
||||
return accTradeMapper.insertAccTrade(accTrade);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
throw new ServiceException("错误信息描述" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public class AccTradeServiceImpl implements IAccTradeService {
|
|||
BeanUtils.copyProperties(accTradeVo, accTrade);
|
||||
return accTradeMapper.insertAccTrade(accTrade);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
throw new ServiceException("错误信息描述" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,19 +84,17 @@ public class AccTradeServiceImpl implements IAccTradeService {
|
|||
try {
|
||||
return accTradeMapper.updateAccTrade(accTrade);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
throw new ServiceException("错误信息描述" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAccTradeVo(AccTradeVo accTradeVo) {
|
||||
public int updateAccTradeVoByOrderNo(AccTradeVo accTradeVo) {
|
||||
accTradeVo.setUpdateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
AccTrade accTrade = new AccTrade();
|
||||
BeanUtils.copyProperties(accTradeVo, accTrade);
|
||||
return accTradeMapper.updateAccTrade(accTrade);
|
||||
return accTradeMapper.updateAccTradeVoByOrderNo(accTradeVo);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
throw new ServiceException("错误信息描述" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.alipay.api.internal.util.AlipaySignature;
|
|||
import com.bonus.canteen.core.account.constants.AccTradeStateEnum;
|
||||
import com.bonus.canteen.core.account.service.IAccTradeService;
|
||||
import com.bonus.canteen.core.pay.constants.PayStateEnum;
|
||||
import com.bonus.canteen.core.pay.dto.AccTradeVo;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccTradeVo;
|
||||
import com.bonus.canteen.core.pay.util.AlipayConfig;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -66,10 +66,10 @@ public class NotifyCotroller {
|
|||
AccTradeVo updateTrade = new AccTradeVo();
|
||||
updateTrade.setOrderNo(order_no);
|
||||
updateTrade.setThirdTradeNo(third_trade_no);
|
||||
updateTrade.setPayState(PayStateEnum.PAY_SUCC.getKey());
|
||||
updateTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey());
|
||||
updateTrade.setPayState(PayStateEnum.PAY_SUCC.getKey().longValue());
|
||||
updateTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey().longValue());
|
||||
updateTrade.setFailReason(trade_status);
|
||||
this.accTradeService.updateAccTradeVo(updateTrade);
|
||||
this.accTradeService.updateAccTradeVoByOrderNo(updateTrade);
|
||||
} else if ("TRADE_SUCCESS".equals(trade_status)) {
|
||||
//判断该笔订单是否已经做过处理
|
||||
//如果没做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详情,判断金额是否等于 total_amount,并执行商户的业务程序
|
||||
|
|
@ -78,19 +78,19 @@ public class NotifyCotroller {
|
|||
AccTradeVo updateTrade = new AccTradeVo();
|
||||
updateTrade.setOrderNo(order_no);
|
||||
updateTrade.setThirdTradeNo(third_trade_no);
|
||||
updateTrade.setPayState(PayStateEnum.PAY_SUCC.getKey());
|
||||
updateTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey());
|
||||
updateTrade.setPayState(PayStateEnum.PAY_SUCC.getKey().longValue());
|
||||
updateTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey().longValue());
|
||||
updateTrade.setFailReason(trade_status);
|
||||
this.accTradeService.updateAccTradeVo(updateTrade);
|
||||
this.accTradeService.updateAccTradeVoByOrderNo(updateTrade);
|
||||
//TODO 增加用户的个人钱包 acc_wallet_info
|
||||
} else {
|
||||
AccTradeVo updateTrade = new AccTradeVo();
|
||||
updateTrade.setOrderNo(order_no);
|
||||
updateTrade.setThirdTradeNo(third_trade_no);
|
||||
updateTrade.setPayState(PayStateEnum.PAY_FAIL.getKey());
|
||||
updateTrade.setTradeState(AccTradeStateEnum.CLOSE.getKey());
|
||||
updateTrade.setPayState(PayStateEnum.PAY_FAIL.getKey().longValue());
|
||||
updateTrade.setTradeState(AccTradeStateEnum.CLOSE.getKey().longValue());
|
||||
updateTrade.setFailReason(trade_status);
|
||||
this.accTradeService.updateAccTradeVo(updateTrade);
|
||||
this.accTradeService.updateAccTradeVoByOrderNo(updateTrade);
|
||||
}
|
||||
|
||||
out.println("success");
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ import com.bonus.canteen.core.account.constants.AccTradeStateEnum;
|
|||
import com.bonus.canteen.core.account.constants.AccTradeTypeEnum;
|
||||
import com.bonus.canteen.core.account.service.IAccTradeService;
|
||||
import com.bonus.canteen.core.pay.constants.PayStateEnum;
|
||||
import com.bonus.canteen.core.pay.constants.PayTypeEnum;
|
||||
import com.bonus.canteen.core.pay.util.AlipayConfig;
|
||||
import com.bonus.canteen.core.pay.dto.AccTradeVo;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccTradeVo;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -22,6 +23,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -42,13 +44,16 @@ public class PayCotroller {
|
|||
// 预装数据,存档
|
||||
accTradeVo.setUserId(SecurityUtils.getUserId());
|
||||
accTradeVo.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
|
||||
accTradeVo.setTradeType(AccTradeTypeEnum.CONSUME.getKey());
|
||||
accTradeVo.setOrderNo(GlobalConstants.TENANT_ID + "_" + UUID.randomUUID().toString().replaceAll("-",""));
|
||||
accTradeVo.setOrderName(GlobalConstants.TENANT_ID + "_" + SecurityUtils.getUserId() + "_" + GlobalConstants.PERSONAL_RECHARGE);
|
||||
accTradeVo.setTradeType(AccTradeTypeEnum.CONSUME.getKey().longValue());
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
accTradeVo.setOrderNo(GlobalConstants.TENANT_ID + "_" + UUID.randomUUID().toString().replaceAll("-","") + "_" + sdf.format(date));
|
||||
accTradeVo.setOrderName(GlobalConstants.TENANT_ID + "_" + SecurityUtils.getUserId() + "_" + GlobalConstants.PERSONAL_RECHARGE + "_" + sdf.format(date));
|
||||
accTradeVo.setTradeTime(new Date());
|
||||
accTradeVo.setAmount(accTradeVo.getPaymentAmount().multiply(new BigDecimal(100)).longValue());
|
||||
accTradeVo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
||||
accTradeVo.setTradeState(AccTradeStateEnum.CREATE.getKey());
|
||||
accTradeVo.setPayType(PayTypeEnum.MEAL_CARD.getKey().longValue());
|
||||
accTradeVo.setPayState(PayStateEnum.PAY_INPROCESS.getKey().longValue());
|
||||
accTradeVo.setTradeState(AccTradeStateEnum.CREATE.getKey().longValue());
|
||||
accTradeService.insertAccTradeVo(accTradeVo);
|
||||
// 调用alipay
|
||||
alipayRequest.setBizContent(
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="thirdTradeNo" column="third_trade_no" />
|
||||
<result property="machineSn" column="machine_sn" />
|
||||
<result property="batchNum" column="batch_num" />
|
||||
<result property="leOrdNo" column="le_ord_no" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="originTradeId" column="origin_trade_id" />
|
||||
<result property="subTimeRuleId" column="sub_time_rule_id" />
|
||||
<result property="manageCost" column="manage_cost" />
|
||||
|
|
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="thirdTradeNo != null and thirdTradeNo != ''"> and third_trade_no = #{thirdTradeNo}</if>
|
||||
<if test="machineSn != null and machineSn != ''"> and machine_sn = #{machineSn}</if>
|
||||
<if test="batchNum != null and batchNum != ''"> and batch_num = #{batchNum}</if>
|
||||
<if test="leOrdNo != null "> and le_ord_no = #{leOrdNo}</if>
|
||||
<if test="orderNo != null "> and order_no = #{orderNo}</if>
|
||||
<if test="originTradeId != null "> and origin_trade_id = #{originTradeId}</if>
|
||||
<if test="subTimeRuleId != null "> and sub_time_rule_id = #{subTimeRuleId}</if>
|
||||
<if test="manageCost != null "> and manage_cost = #{manageCost}</if>
|
||||
|
|
@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="thirdTradeNo != null">third_trade_no,</if>
|
||||
<if test="machineSn != null">machine_sn,</if>
|
||||
<if test="batchNum != null">batch_num,</if>
|
||||
<if test="leOrdNo != null">le_ord_no,</if>
|
||||
<if test="orderNo != null">order_no,</if>
|
||||
<if test="originTradeId != null">origin_trade_id,</if>
|
||||
<if test="subTimeRuleId != null">sub_time_rule_id,</if>
|
||||
<if test="manageCost != null">manage_cost,</if>
|
||||
|
|
@ -136,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="thirdTradeNo != null">#{thirdTradeNo},</if>
|
||||
<if test="machineSn != null">#{machineSn},</if>
|
||||
<if test="batchNum != null">#{batchNum},</if>
|
||||
<if test="leOrdNo != null">#{leOrdNo},</if>
|
||||
<if test="orderNo != null">#{orderNo},</if>
|
||||
<if test="originTradeId != null">#{originTradeId},</if>
|
||||
<if test="subTimeRuleId != null">#{subTimeRuleId},</if>
|
||||
<if test="manageCost != null">#{manageCost},</if>
|
||||
|
|
@ -174,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="thirdTradeNo != null">third_trade_no = #{thirdTradeNo},</if>
|
||||
<if test="machineSn != null">machine_sn = #{machineSn},</if>
|
||||
<if test="batchNum != null">batch_num = #{batchNum},</if>
|
||||
<if test="leOrdNo != null">le_ord_no = #{leOrdNo},</if>
|
||||
<if test="orderNo != null">order_no = #{orderNo},</if>
|
||||
<if test="originTradeId != null">origin_trade_id = #{originTradeId},</if>
|
||||
<if test="subTimeRuleId != null">sub_time_rule_id = #{subTimeRuleId},</if>
|
||||
<if test="manageCost != null">manage_cost = #{manageCost},</if>
|
||||
|
|
@ -195,6 +195,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where trade_id = #{tradeId}
|
||||
</update>
|
||||
|
||||
<update id="updateAccTradeVoByOrderNo" parameterType="com.bonus.canteen.core.account.domain.vo.AccTradeVo">
|
||||
update acc_trade
|
||||
set
|
||||
third_trade_no = #{thirdTradeNo},pay_state = #{payState},
|
||||
trade_state = #{tradeState},fail_reason = #{failReason},update_time = #{updateTime}
|
||||
where order_no = #{orderNo}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAccTradeByTradeId" parameterType="Long">
|
||||
delete from acc_trade where trade_id = #{tradeId}
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue