Merge remote-tracking branch 'origin/master'

This commit is contained in:
但星霖 2022-06-01 14:51:09 +08:00
commit c448ab8a6d
36 changed files with 293 additions and 476 deletions

View File

@ -68,6 +68,7 @@ public class GoodsController extends BaseController {
goodsService.addGoods(goods); goodsService.addGoods(goods);
return AjaxResult.success("新增成功"); return AjaxResult.success("新增成功");
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
logger.error(e.getMessage()); logger.error(e.getMessage());
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
} }

View File

@ -2,6 +2,8 @@ package com.ghy.web.controller.order;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.enums.OrderStatus;
import com.ghy.common.enums.PayStatus;
import com.ghy.common.utils.StringUtils; import com.ghy.common.utils.StringUtils;
import com.ghy.customer.domain.Customer; import com.ghy.customer.domain.Customer;
import com.ghy.customer.service.CustomerService; import com.ghy.customer.service.CustomerService;
@ -108,6 +110,16 @@ public class OrderController extends BaseController {
od.setRevTime(new Date()); od.setRevTime(new Date());
orderDetailService.insertOrderDetail(od); orderDetailService.insertOrderDetail(od);
// 批量生成订单商品
request.getGoodsList().forEach(goods->{
OrderGoods orderGoods = new OrderGoods();
orderGoods.setGoodsId(goods.getGoodsStandardId());
orderGoods.setGoodsNum(goods.getNum());
orderGoods.setOrderId(od.getId());
orderGoods.setServerGoodsNum(0);
orderGoodsService.insertOrderGoods(orderGoods);
});
String leaderTeamMoney = assignWorker.getLeaderTeamMoney(); String leaderTeamMoney = assignWorker.getLeaderTeamMoney();
String leaderTeamRate = assignWorker.getLeaderTeamRate(); String leaderTeamRate = assignWorker.getLeaderTeamRate();
// 派单师傅的钱 // 派单师傅的钱
@ -170,6 +182,8 @@ public class OrderController extends BaseController {
Set<Long> goodsStandardIds = appGoodsList.stream().map(AppGoodsRequest::getGoodsStandardId).collect(Collectors.toSet()); Set<Long> goodsStandardIds = appGoodsList.stream().map(AppGoodsRequest::getGoodsStandardId).collect(Collectors.toSet());
// 所有商品 // 所有商品
List<GoodsStandard> goodsList = goodsStandardService.selectByIds(goodsStandardIds); List<GoodsStandard> goodsList = goodsStandardService.selectByIds(goodsStandardIds);
// 商品所属师傅
Goods goods = goodsService.selectById(goodsList.get(0).getGoodsId());
// 商户ID // 商户ID
Long deptId = appOrderRequest.getDeptId(); Long deptId = appOrderRequest.getDeptId();
Assert.notNull(deptId, "deptId is null!"); Assert.notNull(deptId, "deptId is null!");
@ -179,10 +193,12 @@ public class OrderController extends BaseController {
orderMaster.setDeptId(deptId); orderMaster.setDeptId(deptId);
orderMaster.setCode(orderMasterService.createOrderCode()); orderMaster.setCode(orderMasterService.createOrderCode());
orderMaster.setOrderType(1); orderMaster.setOrderType(1);
orderMaster.setOrderStatus(0); orderMaster.setPayType(appOrderRequest.getPayType());
orderMaster.setOrderStatus(OrderStatus.PLAIN.getCode());
orderMaster.setCustomerId(appOrderRequest.getCustomerId()); orderMaster.setCustomerId(appOrderRequest.getCustomerId());
orderMaster.setPayStatus(0); orderMaster.setPayStatus(PayStatus.WAIT_PAY.getCode());
orderMaster.setCreateTime(new Date()); orderMaster.setCreateTime(new Date());
orderMaster.setWorkerId(goods.getWorkerId());
orderMasterService.insertOrderMaster(orderMaster); orderMasterService.insertOrderMaster(orderMaster);
Assert.notNull(orderMaster.getId(), "OrderMaster.id is null!"); Assert.notNull(orderMaster.getId(), "OrderMaster.id is null!");

View File

@ -1,6 +1,6 @@
package com.ghy.web.controller.pay; package com.ghy.web.controller.pay;
import com.ghy.common.adapay.callback.Event; import com.ghy.common.adapay.model.Event;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
import com.ghy.common.utils.spring.SpringUtils; import com.ghy.common.utils.spring.SpringUtils;
import com.ghy.payment.service.CallBackService; import com.ghy.payment.service.CallBackService;
@ -19,8 +19,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
public class AdapayCallbackController extends BaseController { public class AdapayCallbackController extends BaseController {
private CallBackService callBackService;
@PostMapping("/adapay/callback") @PostMapping("/adapay/callback")
public String callback(Event event) { public String callback(Event event) {
logger.info(" 收单返回消息event" + event); logger.info(" 收单返回消息event" + event);
@ -45,15 +43,19 @@ public class AdapayCallbackController extends BaseController {
switch (type) { switch (type) {
case "payment.succeeded": case "payment.succeeded":
case "payment.failed": case "payment.failed":
beanName = "payCallBackService"; beanName = "payCallbackService";
break;
case "payment_reverse.succeeded":
case "payment_reverse.failed":
beanName = "payReverseCallbackService";
break; break;
case "payment.close.succeeded": case "payment.close.succeeded":
case "payment.close.failed": case "payment.close.failed":
beanName = "refundCallBackService"; beanName = "refundCallbackService";
break; break;
case "cash.succeeded": case "cash.succeeded":
case "cash.failed": case "cash.failed":
beanName = "drawCashCallBackService"; beanName = "drawCashCallbackService";
break; break;
default: default:
logger.warn("UNKNOWN EVENT TYPE [{}]", type); logger.warn("UNKNOWN EVENT TYPE [{}]", type);
@ -61,7 +63,7 @@ public class AdapayCallbackController extends BaseController {
} }
logger.info("handler bean is {} ", beanName); logger.info("handler bean is {} ", beanName);
callBackService = SpringUtils.getBean(beanName); CallBackService callBackService = SpringUtils.getBean(beanName);
callBackService.onCallback(event); callBackService.onCallback(event);
return "OK"; return "OK";
} }

View File

@ -1,23 +0,0 @@
package com.ghy.web.core.adapay;
import com.ghy.common.adapay.callback.IDrawCashCallback;
import com.ghy.common.adapay.model.DrawCashReply;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* 处理提现结果
*
* @author HH 2022/5/27
*/
@Component
public class DrawCashCallback implements IDrawCashCallback {
private static final Logger logger = LoggerFactory.getLogger(DrawCashCallback.class);
@Override
public void onCallback(DrawCashReply reply) {
logger.info("提现结果:{}", reply);
}
}

View File

@ -1,62 +0,0 @@
package com.ghy.web.core.adapay;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.callback.IPayCallback;
import com.ghy.common.adapay.model.AdapayStatusEnum;
import com.ghy.common.adapay.model.PayReply;
import com.ghy.common.adapay.model.PaymentDTO;
import com.ghy.payment.domain.FinancialMaster;
import com.ghy.payment.service.FinancialMasterService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 处理支付结果
*
* @author HH 2022/5/27
*/
@Component
public class PayCallback implements IPayCallback {
private static final Logger logger = LoggerFactory.getLogger(PayCallback.class);
@Resource
FinancialMasterService financialMasterService;
@Override
public void onCallback(PayReply reply) {
// 更新交易记录
PaymentDTO payment = new PaymentDTO();
payment.setId(reply.getId());
payment.setStatus(reply.getStatus());
payment.setPayTime(reply.getPayTime());
financialMasterService.updatePayment(payment);
if (AdapayStatusEnum.succeeded.code.equals(reply.getStatus())) {
// 修改主财务单状态
financialMasterService.paySucceeded(reply.getOrderNo(), reply.getPayChannel());
} else {
logger.warn("支付失败 : {}", reply);
}
}
@Override
public void onResponse(JSONObject response) {
// 保存一条支付记录
PaymentDTO payment = response.toJavaObject(PaymentDTO.class);
payment.setStatus("pending");
financialMasterService.insertPayment(payment);
if (AdapayStatusEnum.succeeded.code.equals(response.getString("status"))) {
FinancialMaster update = new FinancialMaster();
update.setOrderMasterCode(response.getString("order_no"));
update.setPaymentId(response.getString("id"));
financialMasterService.updateFinancialMaster(update);
} else {
logger.warn("请求支付失败 : {}", response.toJSONString());
}
}
}

View File

@ -1,23 +0,0 @@
package com.ghy.web.core.adapay;
import com.ghy.common.adapay.callback.IRefundCallback;
import com.ghy.common.adapay.model.RefundReply;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* 处理退款结果
*
* @author HH 2022/5/27
*/
@Component
public class RefundCallback implements IRefundCallback {
private static final Logger logger = LoggerFactory.getLogger(RefundCallback.class);
@Override
public void onCallback(RefundReply reply) {
logger.info("退款结果:{}", reply);
}
}

View File

@ -1,14 +0,0 @@
package com.ghy.common.adapay.callback;
import com.ghy.common.adapay.model.DrawCashReply;
/**
* 处理提现结果的接口
*
* @author HH 2022/4/1
*/
public interface IDrawCashCallback {
void onCallback(DrawCashReply reply);
}

View File

@ -1,16 +0,0 @@
package com.ghy.common.adapay.callback;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.model.PayReply;
/**
* 处理支付结果的回调接口
*
* @author HH 2022/3/25
*/
public interface IPayCallback {
void onCallback(PayReply reply);
void onResponse(JSONObject response);
}

View File

@ -1,13 +0,0 @@
package com.ghy.common.adapay.callback;
import com.ghy.common.adapay.model.RefundReply;
/**
* 处理退款结果的回调接口
*
* @author HH 2022/3/29
*/
public interface IRefundCallback {
void onCallback(RefundReply reply);
}

View File

@ -1,40 +0,0 @@
package com.ghy.common.adapay.callback.mapping;
import com.alibaba.fastjson.JSON;
import com.ghy.common.adapay.callback.IDrawCashCallback;
import com.ghy.common.adapay.callback.Event;
import com.ghy.common.adapay.model.DrawCashReply;
import org.springframework.util.Assert;
import java.util.concurrent.ConcurrentHashMap;
/**
* 提现结果匹配
*
* @author HH 2022/4/1
*/
public class DrawCashReplyMapping {
/**
* 临时保存支付结果
* key: orderNo
* value: 处理支付结果的回调接口
*/
private final static ConcurrentHashMap<String, IDrawCashCallback> PAY_RESULT_CALLBACK_MAP = new ConcurrentHashMap<>(1024);
public static void putReply(Event event, IDrawCashCallback callback) {
String data = event.getData();
DrawCashReply reply = JSON.parseObject(data, DrawCashReply.class);
Assert.hasText(reply.getOrderNo(), "orderNo is blank !!!");
PAY_RESULT_CALLBACK_MAP.remove(reply.getOrderNo());
if (callback != null) {
callback.onCallback(reply);
}
}
public static void putCallback(String orderNo, IDrawCashCallback callback) {
Assert.hasText(orderNo, "orderNo is blank !!!");
Assert.notNull(callback, "PayCallback is null !!!");
PAY_RESULT_CALLBACK_MAP.put(orderNo, callback);
}
}

View File

@ -1,47 +0,0 @@
package com.ghy.common.adapay.callback.mapping;
import com.alibaba.fastjson.JSON;
import com.ghy.common.adapay.callback.Event;
import com.ghy.common.adapay.callback.IPayCallback;
import com.ghy.common.adapay.model.PayReply;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import java.util.concurrent.ConcurrentHashMap;
/**
* 支付结果匹配
*
* @author HH 2022/3/25
*/
public class PayReplyMapping {
protected static final Logger logger = LoggerFactory.getLogger(PayReplyMapping.class);
/**
* 临时保存支付结果
* key: orderNo
* value: 处理支付结果的回调接口
*/
private final static ConcurrentHashMap<String, IPayCallback> PAY_RESULT_CALLBACK_MAP = new ConcurrentHashMap<>(1024);
public static void putReply(Event event, IPayCallback callback) {
String data = event.getData();
PayReply payment = JSON.parseObject(data, PayReply.class);
Assert.hasText(payment.getOrderNo(), "orderNo is blank !!!");
payment.setPayTime(event.getCreatedTime());
PAY_RESULT_CALLBACK_MAP.remove(payment.getOrderNo());
if (callback != null) {
callback.onCallback(payment);
} else {
logger.warn("PayCallback don't exist! {}", payment);
}
}
public static void putCallback(String orderNo, IPayCallback callback) {
Assert.hasText(orderNo, "orderNo is blank !!!");
Assert.notNull(callback, "PayCallback is null !!!");
PAY_RESULT_CALLBACK_MAP.put(orderNo, callback);
}
}

View File

@ -1,40 +0,0 @@
package com.ghy.common.adapay.callback.mapping;
import com.alibaba.fastjson.JSON;
import com.ghy.common.adapay.callback.Event;
import com.ghy.common.adapay.callback.IRefundCallback;
import com.ghy.common.adapay.model.RefundReply;
import org.springframework.util.Assert;
import java.util.concurrent.ConcurrentHashMap;
/**
* 退款结果匹配
*
* @author HH 2022/3/29
*/
public class RefundReplyMapping {
/**
* 临时保存退款结果
* key: orderNo
* value: 处理支付结果的回调接口
*/
private final static ConcurrentHashMap<String, IRefundCallback> PAY_RESULT_CALLBACK_MAP = new ConcurrentHashMap<>(1024);
public static void putReply(Event event, IRefundCallback refundCallback) {
String data = event.getData();
RefundReply payment = JSON.parseObject(data, RefundReply.class);
Assert.hasText(payment.getPaymentId(), "paymentId is blank !!!");
IRefundCallback callback = PAY_RESULT_CALLBACK_MAP.remove(payment.getPaymentId());
if (callback != null) {
callback.onCallback(payment);
}
}
public static void putCallback(String paymentId, IRefundCallback callback) {
Assert.hasText(paymentId, "paymentId is blank !!!");
Assert.notNull(callback, "RefundCallback is null !!!");
PAY_RESULT_CALLBACK_MAP.put(paymentId, callback);
}
}

View File

@ -1,4 +1,4 @@
package com.ghy.common.adapay.callback; package com.ghy.common.adapay.model;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;

View File

@ -33,6 +33,9 @@ public class Goods extends BaseEntity {
@Excel(name = "商品排序", cellType = Excel.ColumnType.NUMERIC) @Excel(name = "商品排序", cellType = Excel.ColumnType.NUMERIC)
private Integer goodsSort; private Integer goodsSort;
@Excel(name = "归属师傅", cellType = Excel.ColumnType.NUMERIC)
private Long workerId;
@Excel(name = "类别id,必须是关联到系统的第三级目录") @Excel(name = "类别id,必须是关联到系统的第三级目录")
private Long deptGoodsCategoryId; private Long deptGoodsCategoryId;

View File

@ -1,6 +1,7 @@
package com.ghy.goods.mapper; package com.ghy.goods.mapper;
import com.ghy.goods.domain.GoodsArea; import com.ghy.goods.domain.GoodsArea;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -16,6 +17,6 @@ public interface GoodsAreaMapper {
* @param areas 区域集合id * @param areas 区域集合id
* @return 批量insert成功条数 * @return 批量insert成功条数
*/ */
int batchInsert(List<GoodsArea> areas); int batchInsert(@Param("areas") List<GoodsArea> areas);
} }

View File

@ -18,7 +18,7 @@ public interface GoodsImgsMapper {
* @param goodsImgs 商品图片信息 * @param goodsImgs 商品图片信息
* @return 成功条数 * @return 成功条数
*/ */
int batchInsert(Collection<GoodsImgs> goodsImgs); int batchInsert(@Param("goodsImgs") List<GoodsImgs> goodsImgs);
/** /**
* 批量修改商品图片 * 批量修改商品图片

View File

@ -2,6 +2,7 @@ package com.ghy.goods.mapper;
import com.ghy.goods.domain.GoodsStandard; import com.ghy.goods.domain.GoodsStandard;
import com.ghy.goods.request.AppGoodsRequest; import com.ghy.goods.request.AppGoodsRequest;
import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -34,7 +35,7 @@ public interface GoodsStandardMapper {
* @param goodsStandardList 批量添加商品规格 * @param goodsStandardList 批量添加商品规格
* @return 添加成功条数 * @return 添加成功条数
*/ */
int batchInsert(List<GoodsStandard> goodsStandardList); int batchInsert(@Param("goodsStandards") List<GoodsStandard> goodsStandardList);
/** /**
* @param request 校验的商品数量 * @param request 校验的商品数量

View File

@ -17,7 +17,7 @@ public interface GoodsImgsService {
* @param goodsImgs 商品图片信息 * @param goodsImgs 商品图片信息
* @return * @return
*/ */
int batchInsert(Collection<GoodsImgs> goodsImgs); int batchInsert(List<GoodsImgs> goodsImgs);
/** /**
* 批量编辑商品图片信息 * 批量编辑商品图片信息

View File

@ -4,6 +4,7 @@ import com.ghy.goods.domain.GoodsArea;
import com.ghy.goods.mapper.GoodsAreaMapper; import com.ghy.goods.mapper.GoodsAreaMapper;
import com.ghy.goods.service.GoodsAreaService; import com.ghy.goods.service.GoodsAreaService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@ -23,8 +23,7 @@ public class GoodsImgsServiceImpl implements GoodsImgsService {
GoodsImgsMapper goodsImgsMapper; GoodsImgsMapper goodsImgsMapper;
@Override @Override
public int batchInsert(Collection<GoodsImgs> goodsImgs) { public int batchInsert(List<GoodsImgs> goodsImgs) {
if (CollectionUtils.isEmpty(goodsImgs)) return 0;
return goodsImgsMapper.batchInsert(goodsImgs); return goodsImgsMapper.batchInsert(goodsImgs);
} }

View File

@ -24,18 +24,11 @@
</where> </where>
</select> </select>
<insert id="batchInsert" parameterType="com.ghy.goods.domain.GoodsArea" useGeneratedKeys="true" keyProperty="goodsAreaId"> <insert id="batchInsert" parameterType="list" >
<foreach collection="array" item="areas"> INSERT INTO goods_area ( goods_id,country_area_id)
INSERT INTO goods_imgs( VALUES
<if test="goodsImgsId != null and goodsImgsId != 0">goods_imgs_id,</if> <foreach collection="areas" separator="," item="area">
<if test="goodsId != null and goodsId != 0">goods_id,</if> (#{area.goodsId},#{area.countryAreaId})
<if test="imgUrl != null and imgUrl != ''">img_url</if>
)
VALUES(
<if test="goodsImgsId != null and goodsImgsId != 0">#{goodsImgsId},</if>
<if test="goodsId != null and goodsId != 0">#{goodsId},</if>
<if test="imgUrl != null and imgUrl != ''">#{imgUrl}</if>
);
</foreach> </foreach>
</insert> </insert>

View File

@ -3,10 +3,10 @@
<mapper namespace="com.ghy.goods.mapper.GoodsImgsMapper"> <mapper namespace="com.ghy.goods.mapper.GoodsImgsMapper">
<resultMap id="GoodsImgsResult" type="com.ghy.goods.domain.GoodsImgs"> <resultMap id="GoodsImgsResult" type="com.ghy.goods.domain.GoodsImgs">
<result property="goodsImgsId" column="goods_imgs_id" /> <result property="goodsImgsId" column="goods_imgs_id"/>
<result property="goodsId" column="goods_id" /> <result property="goodsId" column="goods_id"/>
<result property="imgUrl" column="img_url" /> <result property="imgUrl" column="img_url"/>
<result property="imgType" column="img_type" /> <result property="imgType" column="img_type"/>
</resultMap> </resultMap>
<sql id="selectGoodsImgs"> <sql id="selectGoodsImgs">
@ -22,7 +22,9 @@
</delete> </delete>
<delete id="deleteByGoodsId"> <delete id="deleteByGoodsId">
DELETE FROM goods_imgs WHERE goods_id = #{goodsId} DELETE
FROM goods_imgs
WHERE goods_id = #{goodsId}
</delete> </delete>
<select id="selectByGoodsId" resultMap="GoodsImgsResult"> <select id="selectByGoodsId" resultMap="GoodsImgsResult">
@ -34,22 +36,27 @@
</where> </where>
</select> </select>
<insert id="batchInsert" parameterType="com.ghy.goods.domain.GoodsImgs" useGeneratedKeys="true" keyProperty="goodsImgsId"> <insert id="batchInsert" parameterType="list">
<foreach collection="array" item="goodsImgs"> INSERT INTO
INSERT INTO goods_imgs( goods_imgs
<if test="goodsImgsId != null and goodsImgsId != 0">goods_imgs_id,</if> (
<if test="goodsId != null and goodsId != 0">goods_id,</if> goods_id,
<if test="imgUrl != null and imgUrl != ''">img_url,</if> img_url,
<if test="remark != null and remark != ''">remark,</if> img_type,
<if test="createBy != null and createBy != ''">create_by,</if> remark,
create_time) create_by,
VALUES( create_time
<if test="goodsImgsId != null and goodsImgsId != 0">#{goodsImgsId},</if> )
<if test="goodsId != null and goodsId != 0">#{goodsId},</if> VALUES
<if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if> <foreach collection="goodsImgs" separator="," item="goodsImg">
<if test="remark != null and remark != ''">#{remark},</if> (
<if test="createBy != null and createBy != ''">#{createBy},</if> #{goodsImg.goodsId},
sysdate()); #{goodsImg.imgUrl},
#{goodsImg.imgType},
#{goodsImg.remark},
#{goodsImg.createBy},
sysdate()
)
</foreach> </foreach>
</insert> </insert>

View File

@ -9,6 +9,7 @@
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id" />
<result property="goodsName" column="goods_name" /> <result property="goodsName" column="goods_name" />
<result property="goodsSort" column="goods_sort"/> <result property="goodsSort" column="goods_sort"/>
<result property="workerId" column="worker_id"/>
<result property="deptGoodsCategoryId" column="dept_goods_category_id"/> <result property="deptGoodsCategoryId" column="dept_goods_category_id"/>
<result property="goodsImgUrl" column="goods_img_url"/> <result property="goodsImgUrl" column="goods_img_url"/>
<result property="goodsVideoUrl" column="goods_video_url"/> <result property="goodsVideoUrl" column="goods_video_url"/>
@ -21,7 +22,7 @@
</resultMap> </resultMap>
<sql id="selectGoods"> <sql id="selectGoods">
SELECT goods_id, goods_code, dept_id, goods_name, goods_sort, SELECT goods_id, goods_code, dept_id, goods_name, goods_sort, worker_id,
dept_goods_category_id, goods_img_url, goods_video_url, status, create_by, create_time, remark dept_goods_category_id, goods_img_url, goods_video_url, status, create_by, create_time, remark
FROM goods FROM goods
</sql> </sql>
@ -54,6 +55,7 @@
<if test="deptId != null and deptId != ''">dept_id,</if> <if test="deptId != null and deptId != ''">dept_id,</if>
<if test="goodsName != null and goodsName != ''">goods_name,</if> <if test="goodsName != null and goodsName != ''">goods_name,</if>
<if test="goodsSort != null and goodsSort != ''">goods_sort,</if> <if test="goodsSort != null and goodsSort != ''">goods_sort,</if>
<if test="workerId != null and workerId != ''">worker_id,</if>
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != 0">dept_goods_category_id,</if> <if test="deptGoodsCategoryId != null and deptGoodsCategoryId != 0">dept_goods_category_id,</if>
<if test="goodsImgUrl != null and goodsImgUrl != ''">goods_img_url,</if> <if test="goodsImgUrl != null and goodsImgUrl != ''">goods_img_url,</if>
<if test="goodsVideoUrl != null and goodsVideoUrl != ''">goods_video_url,</if> <if test="goodsVideoUrl != null and goodsVideoUrl != ''">goods_video_url,</if>
@ -66,6 +68,7 @@
<if test="deptId != null and deptId != ''">#{deptId},</if> <if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="goodsName != null and goodsName != ''">#{goodsName},</if> <if test="goodsName != null and goodsName != ''">#{goodsName},</if>
<if test="goodsSort != null and goodsSort != ''">#{goodsSort},</if> <if test="goodsSort != null and goodsSort != ''">#{goodsSort},</if>
<if test="workerId != null and workerId != ''">#{workerId},</if>
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != 0">#{deptGoodsCategoryId},</if> <if test="deptGoodsCategoryId != null and deptGoodsCategoryId != 0">#{deptGoodsCategoryId},</if>
<if test="goodsImgUrl != null and goodsImgUrl != ''">#{goodsImgUrl},</if> <if test="goodsImgUrl != null and goodsImgUrl != ''">#{goodsImgUrl},</if>
<if test="goodsVideoUrl != null and goodsVideoUrl != ''">#{goodsVideoUrl},</if> <if test="goodsVideoUrl != null and goodsVideoUrl != ''">#{goodsVideoUrl},</if>

View File

@ -3,31 +3,43 @@
<mapper namespace="com.ghy.goods.mapper.GoodsStandardMapper"> <mapper namespace="com.ghy.goods.mapper.GoodsStandardMapper">
<resultMap id="GoodsStandardResult" type="com.ghy.goods.domain.GoodsStandard"> <resultMap id="GoodsStandardResult" type="com.ghy.goods.domain.GoodsStandard">
<result property="goodsStandardId" column="goods_standard_id" /> <result property="goodsStandardId" column="goods_standard_id"/>
<result property="goodsStandardName" column="goods_standard_name"/> <result property="goodsStandardName" column="goods_standard_name"/>
<result property="goodsId" column="goods_id" /> <result property="goodsId" column="goods_id"/>
<result property="deptGoodsCategoryId" column="dept_goods_category_id"/> <result property="deptGoodsCategoryId" column="dept_goods_category_id"/>
<result property="goodsPrice" column="goods_price"/> <result property="goodsPrice" column="goods_price"/>
<result property="discountPrice" column="discount_price"/> <result property="discountPrice" column="discount_price"/>
<result property="groupPrice" column="group_price"/> <result property="groupPrice" column="group_price"/>
<result property="goodsNum" column="goods_num"/> <result property="goodsNum" column="goods_num"/>
<result property="saleNum" column="sale_num"/> <result property="saleNum" column="sale_num"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<sql id="selectGoodsStandard"> <sql id="selectGoodsStandard">
SELECT goods_standard_id, goods_standard_name, goods_id, dept_goods_category_id, goods_price, SELECT goods_standard_id,
discount_price, group_price, goods_num, create_by, create_time, sale_num, status, update_by, update_time, goods_standard_name,
goods_id,
dept_goods_category_id,
goods_price,
discount_price,
group_price,
goods_num,
create_by,
create_time,
sale_num,
status,
update_by,
update_time,
remark remark
FROM goods_standard FROM goods_standard
</sql> </sql>
<select id="selectById" resultMap="GoodsStandardResult"> <select id="selectById" resultMap="GoodsStandardResult">
<include refid="selectGoodsStandard"/> <include refid="selectGoodsStandard"/>
<where> <where>
@ -54,39 +66,19 @@
</where> </where>
</select> </select>
<insert id="batchInsert" parameterType="com.ghy.goods.domain.GoodsStandard" useGeneratedKeys="true" keyProperty="goodsStandardId"> <insert id="batchInsert" parameterType="list">
<foreach collection="array" item="goodsStandardList"> INSERT INTO goods_standard (
INSERT INTO goods_standard( goods_standard_name, goods_id, dept_goods_category_id, goods_price, discount_price, group_price, goods_num,
<if test="goodsStandardName != null and goodsStandardName != 0">goods_standard_name,</if> sale_num, status, remark, create_by, create_time )
<if test="goodsId != null and goodsId != 0">goods_id,</if> VALUES
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">dept_goods_category_id</if> <foreach collection="goodsStandards" separator="," item="goodsStandard">
<if test="goodsPrice != null and goodsPrice != 0">goods_price,</if> (
<if test="discountPrice != null and discountPrice != 0">discount_price,</if> #{goodsStandard.goodsStandardName}, #{goodsStandard.goodsId}, #{goodsStandard.deptGoodsCategoryId}, #{goodsStandard.goodsPrice}, #{goodsStandard.discountPrice},
<if test="groupPrice != null and groupPrice != 0">group_price,</if> #{goodsStandard.groupPrice}, #{goodsStandard.goodsNum}, #{goodsStandard.saleNum}, #{goodsStandard.status}, #{goodsStandard.remark}, #{goodsStandard.createBy}, sysdate()
<if test="goodsNum != null and goodsNum != 0">goods_num,</if>
<if test="saleNum != null and saleNum != 0">sale_num,</if>
<if test="status != null and status != 0">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
) )
VALUES(
<if test="goodsStandardName != null and goodsStandardName != 0">#{goodsStandardName},</if>
<if test="goodsId != null and goodsId != 0">#{goodsId},</if>
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">#{deptGoodsCategoryId}</if>
<if test="goodsPrice != null and goodsPrice != 0">#{goodsPrice},</if>
<if test="discountPrice != null and discountPrice != 0">#{discountPrice},</if>
<if test="groupPrice != null and groupPrice != 0">#{groupPrice},</if>
<if test="goodsNum != null and goodsNum != 0">#{goodsNum},</if>
<if test="saleNum != null and saleNum != 0">#{saleNum},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
);
</foreach> </foreach>
</insert> </insert>
<select id="checkStore" resultMap="GoodsStandardResult"> <select id="checkStore" resultMap="GoodsStandardResult">
<include refid="selectGoodsStandard"/> <include refid="selectGoodsStandard"/>
where goods_standard_id = #{goodsStandardId} where goods_standard_id = #{goodsStandardId}

View File

@ -1,5 +1,6 @@
package com.ghy.payment.mapper; package com.ghy.payment.mapper;
import com.ghy.common.adapay.model.PaymentDTO;
import com.huifu.adapay.model.Payment; import com.huifu.adapay.model.Payment;
/** /**
@ -12,4 +13,6 @@ public interface PaymentMapper {
int insertPayment(Payment payment); int insertPayment(Payment payment);
int updatePayment(Payment payment); int updatePayment(Payment payment);
PaymentDTO selectById(String id);
} }

View File

@ -3,13 +3,11 @@ package com.ghy.payment.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.AdapayConfig; import com.ghy.common.adapay.AdapayConfig;
import com.ghy.common.adapay.AdapayProperties; import com.ghy.common.adapay.AdapayProperties;
import com.ghy.common.adapay.callback.IDrawCashCallback;
import com.ghy.common.adapay.callback.IPayCallback;
import com.ghy.common.adapay.callback.IRefundCallback;
import com.ghy.common.adapay.callback.mapping.DrawCashReplyMapping;
import com.ghy.common.adapay.callback.mapping.RefundReplyMapping;
import com.ghy.common.adapay.model.*; import com.ghy.common.adapay.model.*;
import com.ghy.payment.service.impl.PayCallBackServiceImpl; import com.ghy.payment.service.impl.DrawCashCallbackService;
import com.ghy.payment.service.impl.PayCallbackService;
import com.ghy.payment.service.impl.PayReverseCallbackService;
import com.ghy.payment.service.impl.RefundCallbackService;
import com.huifu.adapay.core.exception.BaseAdaPayException; import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.*; import com.huifu.adapay.model.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -33,13 +31,13 @@ public class AdapayService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource @Resource
private IPayCallback payCallback; private PayCallbackService payCallBackService;
@Resource @Resource
private PayCallBackServiceImpl payCallBackService; private RefundCallbackService refundCallbackService;
@Resource @Resource
private IDrawCashCallback drawCashCallback; private DrawCashCallbackService drawCashCallbackService;
@Resource @Resource
private IRefundCallback refundCallback; private PayReverseCallbackService payReverseCallbackService;
@Resource @Resource
private AdapayProperties adapayProperties; private AdapayProperties adapayProperties;
@ -237,8 +235,9 @@ public class AdapayService {
cashParam.put("notify_url", adapayProperties.getNotifyUrl()); cashParam.put("notify_url", adapayProperties.getNotifyUrl());
cashParam.put("remark", remark); cashParam.put("remark", remark);
cashParam.put("fee_mode", feeMode); cashParam.put("fee_mode", feeMode);
DrawCashReplyMapping.putCallback(orderNo, drawCashCallback); JSONObject response = (JSONObject) Drawcash.create(cashParam, deptId.toString());
return (JSONObject) Drawcash.create(cashParam, deptId.toString()); drawCashCallbackService.onResponse(response);
return response;
} }
/** /**
@ -298,7 +297,7 @@ public class AdapayService {
} }
/** /**
* 发起退款 * 发起退款用于[延迟分账]或者[延迟分账且确认支付后]的支付单
* 当您的业务需要发起退款时可通过 Adapay 系统提供的创建 Refund对象 方法创建一个退款对象资金会原路退回用户的支付宝或微信中 * 当您的业务需要发起退款时可通过 Adapay 系统提供的创建 Refund对象 方法创建一个退款对象资金会原路退回用户的支付宝或微信中
* 支持一次全额或多次部分退款退款次数最多不超过10次多次部分退款时当前退款金额 + 已退款金额不能大于原支付金额 * 支持一次全额或多次部分退款退款次数最多不超过10次多次部分退款时当前退款金额 + 已退款金额不能大于原支付金额
* 对于每次撤销交易Adapay 都会通过 异步消息通知 告知结果 * 对于每次撤销交易Adapay 都会通过 异步消息通知 告知结果
@ -319,8 +318,9 @@ public class AdapayService {
JSONObject refundParams = new JSONObject(); JSONObject refundParams = new JSONObject();
refundParams.put("refund_amt", refundAmt); refundParams.put("refund_amt", refundAmt);
refundParams.put("refund_order_no", refundOrderNo); refundParams.put("refund_order_no", refundOrderNo);
RefundReplyMapping.putCallback(paymentId, refundCallback); JSONObject response = (JSONObject) Refund.create(paymentId, refundParams, deptId.toString());
return (JSONObject) Refund.create(paymentId, refundParams, deptId.toString()); refundCallbackService.onResponse(response);
return response;
} }
/** /**
@ -362,4 +362,29 @@ public class AdapayService {
return (JSONObject) Member.query(memberParams, deptId.toString()); return (JSONObject) Member.query(memberParams, deptId.toString());
} }
/**
* 支付撤销
* 支付撤销对象适用于[延时分账]的场景只有已支付完成且为延时分账的Payment对象在没有创建支付确认对象成功之前可以调用创建支付撤销对象
* 用来撤销支付资金会原路退回用户的支付宝或微信中 支持一次全额或多次部分撤销撤销次数最多不超过10次
* 多次部分撤销时当前撤销金额 + 已撤销金额 + 已确认金额不能大于原支付金额
* 对于每次撤销交易Adapay 都会通过 异步消息通知 告知结果
* https://docs.adapay.tech/api/trade.html#payment-reverse-object
*
* @param deptId [必填]商户ID
* @param paymentId [必填]Adapay生成的支付对象id
* @param reverseAmt [必填]撤销金额必须大于0保留两位小数点如0.10100.05等撤销金额必须小于等于支付金额 - 已确认金额 - 已撤销撤销成功+撤销中金额
* @return 创建支付撤销对象同步返回成功表示 Adapay 受理成功撤销结果以异步通知为准
*/
public JSONObject payReverse(@NotNull Long deptId, @NotNull String paymentId, @NotNull String reverseAmt) throws BaseAdaPayException {
JSONObject reverseParams = new JSONObject();
reverseParams.put("app_id", AdapayConfig.getAppId(deptId));
reverseParams.put("payment_id", paymentId);
reverseParams.put("reverse_amt", reverseAmt);
reverseParams.put("notify_url", adapayProperties.getNotifyUrl());
reverseParams.put("order_no", "PAYMENT_REVERSE" + System.currentTimeMillis());
JSONObject response = (JSONObject) PaymentReverse.create(reverseParams);
payReverseCallbackService.onResponse(response);
return response;
}
} }

View File

@ -1,16 +1,10 @@
package com.ghy.payment.service; package com.ghy.payment.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.callback.Event; import com.ghy.common.adapay.model.Event;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public interface CallBackService { public interface CallBackService {
public final static ConcurrentMap<String, List<String>> resultCallBackMap = new ConcurrentHashMap<>(1024);
/** /**
* @param event 回调 * @param event 回调
*/ */

View File

@ -76,4 +76,11 @@ public interface FinancialMasterService {
* @param payment 支付对象 * @param payment 支付对象
*/ */
int updatePayment(PaymentDTO payment); int updatePayment(PaymentDTO payment);
/**
* 用交易ID查询交易记录
*
* @param id 交易ID
*/
PaymentDTO selectPaymentById(String id);
} }

View File

@ -1,37 +0,0 @@
package com.ghy.payment.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.callback.Event;
import com.ghy.payment.service.CallBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("drawCashCallBackService")
public class DrawCashCallBackServiceImpl implements CallBackService {
private static Logger logger = LoggerFactory.getLogger(DrawCashCallBackServiceImpl.class);
private final static List<String> drawCashList = new ArrayList<>(1024);
/**
* 临时保存支付结果
* key: orderNo
* value: 处理支付结果的回调接口
*/
@Override
public void onCallback(Event event) {
logger.info("draw callback is {}", event.toString());
}
@Override
public void onResponse(JSONObject response) {
logger.info("draw response is {}", response.toString());
}
}

View File

@ -0,0 +1,30 @@
package com.ghy.payment.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.model.Event;
import com.ghy.payment.service.CallBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* 提现回调
*
* @author HH 2022/5/30
*/
@Service("drawCashCallbackService")
public class DrawCashCallbackService implements CallBackService {
private static final Logger logger = LoggerFactory.getLogger(DrawCashCallbackService.class);
@Override
public void onCallback(Event event) {
logger.info("提现 callback: {}", event.toString());
}
@Override
public void onResponse(JSONObject response) {
logger.info("提现 response: {}", response.toString());
}
}

View File

@ -76,7 +76,7 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
public void paySucceeded(String orderNo, String payChannel) { public void paySucceeded(String orderNo, String payChannel) {
try { try {
financialMasterMapper.paySucceeded(orderNo, PayTypeEnum.valueOf(payChannel.toUpperCase()).getCode()); financialMasterMapper.paySucceeded(orderNo, PayTypeEnum.valueOf(payChannel.toUpperCase()).getCode());
}catch (IllegalArgumentException e){ } catch (IllegalArgumentException e) {
logger.warn("OrderNo[{}] Unknown payChannel [{}]!", orderNo, payChannel); logger.warn("OrderNo[{}] Unknown payChannel [{}]!", orderNo, payChannel);
} }
} }
@ -103,4 +103,9 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
return paymentMapper.updatePayment(payment); return paymentMapper.updatePayment(payment);
} }
@Override
public PaymentDTO selectPaymentById(String id) {
return paymentMapper.selectById(id);
}
} }

View File

@ -2,7 +2,7 @@ package com.ghy.payment.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.callback.Event; import com.ghy.common.adapay.model.Event;
import com.ghy.common.adapay.model.AdapayStatusEnum; import com.ghy.common.adapay.model.AdapayStatusEnum;
import com.ghy.common.adapay.model.PayReply; import com.ghy.common.adapay.model.PayReply;
import com.ghy.common.adapay.model.PaymentDTO; import com.ghy.common.adapay.model.PaymentDTO;
@ -15,41 +15,54 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.HashSet;
import java.util.List;
@Service("payCallBackService") /**
public class PayCallBackServiceImpl implements CallBackService { * 支付回调
*
* @author HH 2022/5/31
*/
@Service("payCallbackService")
public class PayCallbackService implements CallBackService {
private static Logger logger = LoggerFactory.getLogger(PayCallBackServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(PayCallbackService.class);
private final static List<String> payList = new ArrayList<>(1024); // 用HashSet检索效率高
private final static HashSet<String> orderNoSet = new HashSet<>(1024);
@Resource @Resource
FinancialMasterService financialMasterService; FinancialMasterService financialMasterService;
@Override @Override
public void onCallback(Event event) { public void onCallback(Event event) {
logger.debug("pay callback is {}", event);
String data = event.getData(); String data = event.getData();
PayReply payment = JSON.parseObject(data, PayReply.class); PayReply payment = JSON.parseObject(data, PayReply.class);
Assert.hasText(payment.getOrderNo(), "orderNo is blank !!!"); Assert.hasText(payment.getOrderNo(), "orderNo is blank !!!");
// 校验是否是本系统发出去的回调请求 // 校验是否是本系统发出去的回调请求
if(payList.contains(payment.getOrderNo())){ boolean ours = orderNoSet.remove(payment.getOrderNo());
if (!ours) {
//如果内存里没有 就从数据库里找这条记录
PaymentDTO dto = financialMasterService.selectPaymentById(payment.getId());
ours = dto != null;
}
if (ours) {
// 更新交易记录 // 更新交易记录
PaymentDTO param = new PaymentDTO(); PaymentDTO param = new PaymentDTO();
param.setId(payment.getId()); param.setId(payment.getId());
param.setStatus(payment.getStatus()); param.setStatus(payment.getStatus());
param.setPayTime(payment.getPayTime()); param.setPayTime(payment.getPayTime());
financialMasterService.updatePayment(param); financialMasterService.updatePayment(param);
if (AdapayStatusEnum.succeeded.code.equals(payment.getStatus())) { if (AdapayStatusEnum.succeeded.code.equals(payment.getStatus())) {
// 修改主财务单状态 // 修改主财务单状态
financialMasterService.paySucceeded(payment.getOrderNo(), payment.getPayChannel()); financialMasterService.paySucceeded(payment.getOrderNo(), payment.getPayChannel());
} else { } else {
logger.warn("支付失败 : {}", payment); logger.warn("支付失败 : {}", payment);
} }
} else {
logger.warn("系统中不存在这条交易记录: {}", event);
} }
logger.info("pay callback is {}", event.toString());
} }
@Override @Override
@ -67,10 +80,8 @@ public class PayCallBackServiceImpl implements CallBackService {
} else { } else {
logger.warn("请求支付失败 : {}", response.toJSONString()); logger.warn("请求支付失败 : {}", response.toJSONString());
} }
// 将记录保存到临时会话中 // 将记录保存到临时会话中
payList.add(response.getString("order_no")); orderNoSet.add(response.getString("order_no"));
resultCallBackMap.put("pay", payList);
} }
} }

View File

@ -0,0 +1,29 @@
package com.ghy.payment.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.model.Event;
import com.ghy.payment.service.CallBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* 撤销支付回调
*
* @author HH 2022/5/31
*/
@Service("payReverseCallbackService")
public class PayReverseCallbackService implements CallBackService {
private static final Logger logger = LoggerFactory.getLogger(PayReverseCallbackService.class);
@Override
public void onCallback(Event event) {
logger.debug("撤销支付 callback: {}", event.toString());
}
@Override
public void onResponse(JSONObject response) {
logger.debug("撤销支付 Response: {}", response.toString());
}
}

View File

@ -1,25 +0,0 @@
package com.ghy.payment.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.callback.Event;
import com.ghy.payment.service.CallBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service("refundCallBackService")
public class RefundCallBackServiceImpl implements CallBackService {
private static Logger logger = LoggerFactory.getLogger(RefundCallBackServiceImpl.class);
@Override
public void onCallback(Event event) {
logger.info("refund callback is {}", event.toString());
}
@Override
public void onResponse(JSONObject response) {
logger.info("refund response is {}", response.toString());
}
}

View File

@ -0,0 +1,30 @@
package com.ghy.payment.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ghy.common.adapay.model.Event;
import com.ghy.payment.service.CallBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* 退款回调
*
* @author HH 2022/5/30
*/
@Service("refundCallbackService")
public class RefundCallbackService implements CallBackService {
private static final Logger logger = LoggerFactory.getLogger(RefundCallbackService.class);
@Override
public void onCallback(Event event) {
logger.debug("退款 callback: {}", event.toString());
}
@Override
public void onResponse(JSONObject response) {
logger.debug("退款 Response: {}", response.toString());
}
}

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.payment.mapper.PaymentMapper"> <mapper namespace="com.ghy.payment.mapper.PaymentMapper">
<resultMap id="FinancialMasterResult" type="com.ghy.common.adapay.model.PaymentDTO"> <resultMap id="PaymentResult" type="com.ghy.common.adapay.model.PaymentDTO">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="orderNo" column="order_no"/> <result property="orderNo" column="order_no"/>
<result property="prodMode" column="prod_mode"/> <result property="prodMode" column="prod_mode"/>
@ -16,7 +16,7 @@
<result property="payTime" column="pay_time"/> <result property="payTime" column="pay_time"/>
</resultMap> </resultMap>
<sql id="selectFinancialMaster"> <sql id="selectPayment">
SELECT id, order_no, prod_mode, app_id, pay_channel, pay_amt, party_order_id, query_url, SELECT id, order_no, prod_mode, app_id, pay_channel, pay_amt, party_order_id, query_url,
currency, status, pay_time, created_time, update_time currency, status, pay_time, created_time, update_time
FROM adapay_pay_log FROM adapay_pay_log
@ -58,4 +58,8 @@
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="selectById" resultMap="PaymentResult">
<include refid="selectPayment"/> WHERE id = #{id}
</select>
</mapper> </mapper>