Commit 5fea7a15 authored by jiaorz's avatar jiaorz

Merge branch 'master-new-activity' into dev

parents 09d70be7 9c2ce394
package com.xxfc.platform.activity.biz;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.activity.dto.ApLogDTO;
import com.xxfc.platform.activity.entity.ActivityPopularizeItem;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import com.xxfc.platform.activity.mapper.ActivityPopularizeLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import com.xxfc.platform.activity.mapper.ActivityPopularizeLogMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用户参与推广活动(邀请有礼)的活动记录的记录(日志)
......@@ -18,11 +24,19 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
* @date 2019-07-05 15:23:04
*/
@Service
public class ActivityPopularizeLogBiz extends BaseBiz<ActivityPopularizeLogMapper,ActivityPopularizeLog> {
public class ActivityPopularizeLogBiz extends BaseBiz<ActivityPopularizeLogMapper,ActivityPopularizeLog> implements UserRestInterface {
@Autowired
ActivityPopularizeItemBiz activityPopularizeItemBiz;
@Autowired
UserFeign userFeign;
@Override
public UserFeign getUserFeign() {
return userFeign;
}
public ApLogDTO selectOneApLogDTO(ActivityPopularizeLog entity){
ActivityPopularizeLog apl = mapper.selectOne(entity);
if(null != apl) {
......@@ -33,4 +47,18 @@ public class ActivityPopularizeLogBiz extends BaseBiz<ActivityPopularizeLogMappe
return null;
}
}
public List<ActivityPopularizeLog> selectByUserId(Integer popularizeId) {
AppUserDTO appUserDTO = getAppUser();
if (appUserDTO == null) {
return new ArrayList<>();
}
Map<String, Object> param = new HashMap<>();
param.put("userId", appUserDTO.getUserid());
param.put("popularizeId", popularizeId);
List<ActivityPopularizeLog> apl = mapper.selectByUserId(param);
return apl;
}
}
\ No newline at end of file
......@@ -3,6 +3,9 @@ package com.xxfc.platform.activity.mapper;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
/**
* 用户参与推广活动(邀请有礼)的活动记录的记录(日志)
*
......@@ -11,5 +14,5 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-07-05 15:23:04
*/
public interface ActivityPopularizeLogMapper extends Mapper<ActivityPopularizeLog> {
List<ActivityPopularizeLog> selectByUserId(Map<String, Object> param);
}
package com.xxfc.platform.activity.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.activity.biz.ActivityPopularizeLogBiz;
import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -11,4 +12,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("activityPopularizeLog")
public class ActivityPopularizeLogController extends BaseController<ActivityPopularizeLogBiz,ActivityPopularizeLog> {
@GetMapping(value = "/getByUser")
public ObjectRestResponse selectByUserId(Integer popularizeId) {
return ObjectRestResponse.succ(baseBiz.selectByUserId(popularizeId));
}
}
\ No newline at end of file
......@@ -15,4 +15,8 @@
<result property="itemId" column="item_id"/>
</resultMap>
<select id="selectByUserId" resultType="com.xxfc.platform.activity.entity.ActivityPopularizeLog" parameterType="Map">
select * from activity_popularize_log where user_id = #{userId} and popularize_id = #{popularizeId}
</select>
</mapper>
\ No newline at end of file
......@@ -647,7 +647,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
* @param refundReason 退款原因
* @param outRequestNo 退款标志号
*/
public void testTradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
public AlipayTradeRefundResponse testTradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
AlipayClient alipayClient = getAlipayClient();
AlipayTradeRefundModel model = new AlipayTradeRefundModel();
BigDecimal realAmount = new BigDecimal(refundAmount.toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP);
......@@ -664,7 +664,9 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
e.printStackTrace();
}
log.info("response: {}"+response.getBody());
return response;
}
public static void main(String[] args) throws AlipayApiException {
OrderPayBiz orderPayBiz = new OrderPayBiz();
OrderPayVo orderPayVo = new OrderPayVo();
......@@ -674,12 +676,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
orderPayVo.setAmount(3);
orderPayVo.setBody("扣除租车订单费用");
orderPayVo.setSubject("租车订单交易费用");
//orderPayBiz.testTradeRefund("216584713656209408", 105000, "退还违约金1050元", "2165847136562094081050");
//orderPayBiz.testTradeRefund("222522054304468992", 180000, "退还违约金1800元", "222522054304461800");
//orderPayBiz.fundAuthOrderUnFreeze(orderPayVo, "");
//orderPayBiz.alipayOrderRefund("20191024153859000003","2019102422001421530513773694", 2, "xxxx", "");
//orderPayBiz.tradePay(orderPayVo, "");
//orderPayBiz.fundAuthCancel(orderPayVo, "");
//orderPayBiz.tradePay("20191114182254000019", "2019111410002001530505959461", 1,"扣除违约金", "扣除违约金");
orderPayBiz.fundAuthQuery("20191031172653000026");
//orderPayBiz.fundAuthQuery("20191031172653000026");
}
}
package com.xxfc.platform.universal.biz;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
......@@ -142,4 +144,39 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
}
return JsonResultUtil.createFailedResult(40004, "退款失败!");
}
public ObjectRestResponse tradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
AlipayTradeRefundResponse refundResponse = payBiz.testTradeRefund(tradNo, refundAmount, refundReason, outRequestNo);
log.info("预授权转支付退款: {}", refundResponse.getBody());
if (refundResponse == null) {
return ObjectRestResponse.createFailedResult(1002, "预授权转支付失败!");
}
OrderRefund orderRefund = selectByTradNo(tradNo);
if (orderRefund == null) {
return ObjectRestResponse.createFailedResult(1003, "预授权转支付商户订单不存在!");
}
orderRefund.setRefundTradeNo(outRequestNo);
orderRefund.setId(null);
if (refundResponse.getTradeNo() != null) {
orderRefund.setSerialNumber(refundResponse.getTradeNo());
}
orderRefund.setRefundAmount(refundAmount);
orderRefund.setRefundDesc(refundReason + " 预授权转支付商户订单号是:" + tradNo);
orderRefund.setFinishTime(System.currentTimeMillis());
orderRefund.setCrtTime(System.currentTimeMillis());
orderRefund.setUpdTime(System.currentTimeMillis());
mapper.insertSelective(orderRefund);
return ObjectRestResponse.succ(orderRefund);
}
public OrderRefund selectByTradNo(String refundTradeNo) {
if (StringUtils.isNotBlank(refundTradeNo)) {
Example example = new Example(OrderRefund.class);
example.createCriteria().andEqualTo("refundTradeNo", refundTradeNo);
OrderRefund orderRefund = mapper.selectOneByExample(example);
return orderRefund;
}
return null;
}
}
\ No newline at end of file
package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.biz.OrderRefundBiz;
import com.xxfc.platform.universal.entity.OrderRefund;
import com.xxfc.platform.universal.vo.OrderRefundVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("refund")
......@@ -26,4 +25,10 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
}
}
@GetMapping(value = "/app/unauth/tradRefund")
@ApiOperation("预授权转支付接口")
public ObjectRestResponse tradRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
return baseBiz.tradeRefund(tradNo, refundAmount, refundReason, outRequestNo);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment