提交代码

yy_dev
胡锐 1 year ago
parent a6cddeeff5
commit e27e2b4678
  1. 28
      bweb/src/main/java/com/bweb/controller/BsRebatePartMerController.java
  2. 40
      cweb/src/main/java/com/cweb/controller/BsRebateMerAccountOrderController.java
  3. 41
      cweb/src/main/java/com/cweb/notify/WeiXinController.java
  4. 21
      service/src/main/java/com/hfkj/dao/BsRebateMerAccountOrderMapper.java
  5. 42
      service/src/main/java/com/hfkj/dao/BsRebateMerAccountOrderSqlProvider.java
  6. 22
      service/src/main/java/com/hfkj/dao/BsRebatePartMerMapperExt.java
  7. 48
      service/src/main/java/com/hfkj/entity/BsRebateMerAccountOrder.java
  8. 180
      service/src/main/java/com/hfkj/entity/BsRebateMerAccountOrderExample.java
  9. 7
      service/src/main/java/com/hfkj/service/rebate/BsRebateMerAccountOrderServer.java
  10. 7
      service/src/main/java/com/hfkj/service/rebate/BsRebatePartMerService.java
  11. 53
      service/src/main/java/com/hfkj/service/rebate/impl/BsRebateMerAccountOrderServerImpl.java
  12. 5
      service/src/main/java/com/hfkj/service/rebate/impl/BsRebatePartMerServiceImpl.java

@ -100,7 +100,7 @@ public class BsRebatePartMerController {
@RequestMapping(value="/queryPartMerList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取参与户列表")
@ApiOperation(value = "获取参与户列表")
public ResponseData queryPartMerList(@RequestParam(value = "merNo" , required = false) String merNo,
@RequestParam(value = "merName" , required = false) String merName,
@RequestParam(value = "merAbbreviate" , required = false) String merAbbreviate,
@ -109,7 +109,7 @@ public class BsRebatePartMerController {
try {
Map<String,Object> param = new HashMap<>();
param.put("merNo", "merName");
param.put("merNo", merNo);
param.put("merName", merName);
param.put("merAbbreviate", merAbbreviate);
@ -122,5 +122,29 @@ public class BsRebatePartMerController {
}
}
@RequestMapping(value="/queryNotPartMerList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取未参加的商户列表")
public ResponseData queryNotPartMerList(@RequestParam(value = "merNo" , required = false) String merNo,
@RequestParam(value = "merName" , required = false) String merName,
@RequestParam(value = "merAbbreviate" , required = false) String merAbbreviate,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
Map<String,Object> param = new HashMap<>();
param.put("merNo", merNo);
param.put("merName", merName);
param.put("merAbbreviate", merAbbreviate);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(rebatePartMerService.getNotPartMerList(param)));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,13 +1,20 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.channel.weixin.entity.WeChatPayReqInfo;
import com.hfkj.channel.weixin.utils.MD5Util;
import com.hfkj.channel.weixin.utils.WechatPayUtil;
import com.hfkj.common.WeChatMerNo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.MathUtils;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsRebateMerAccount;
import com.hfkj.entity.BsRebateMerAccountOrder;
import com.hfkj.model.ResponseData;
@ -23,9 +30,12 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ThreadLocalRandom;
@Controller
@Api(value = "返利金商户账户订单")
@ -38,6 +48,8 @@ public class BsRebateMerAccountOrderController {
private BsRebateMerAccountService rebateMerAccountService;
@Resource
private BsRebateMerAccountOrderServer rebateMerAccountOrderServer;
@Resource
private WechatPayUtil wechatPayUtil;
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ -84,7 +96,33 @@ public class BsRebateMerAccountOrderController {
Map<String,Object> param = new HashMap<>();
param.put("order", order);
param.put("payParam", null);
if (payType.getCode().equals(TradeOrderPayModeEnum.WECHAT.getCode())) {
if (StringUtils.isBlank(body.getString("openId"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "openId不能为空");
}
// 微信支付【直连】
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo();
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); // 公众号id
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); // 商户号
weChatPayReqInfo.setSub_appid("wxa075e8509802f826"); // 商户号公众号
weChatPayReqInfo.setSub_mch_id(WeChatMerNo.MCH_ID_1614670195); // 子商户号
weChatPayReqInfo.setSub_openid(body.getString("openId"));
weChatPayReqInfo.setNonce_str(MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8")); // 随机字符串
weChatPayReqInfo.setBody("充值"); // 商品描述
weChatPayReqInfo.setOut_trade_no(order.getOrderNo()); // 商户订单号
weChatPayReqInfo.setTotal_fee(order.getTradePrice().multiply(new BigDecimal("100")).intValue()); // 总金额
weChatPayReqInfo.setSpbill_create_ip("122.9.135.148"); // 终端ip
weChatPayReqInfo.setNotify_url(CommonSysConst.getSysConfig().getDomainName()+"/crest/weiXinNotify/rebateMerAccountOrder"); // 通知url
weChatPayReqInfo.setTrade_type("JSAPI"); // 交易类型
weChatPayReqInfo.setProfit_sharing("N");
//附加数据,区分订单类型
Map<String,String> payMap = new HashMap<>();
payMap.put("app_id", weChatPayReqInfo.getSub_appid());
payMap.put("api_key",SysConst.getSysConfig().getWxApiKey());
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl());
param.put("payParam", wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap));
}
return ResponseMsgUtil.success(param);
} catch (Exception e) {

@ -3,14 +3,12 @@ package com.cweb.notify;
import com.hfkj.channel.weixin.utils.IOUtil;
import com.hfkj.channel.weixin.utils.XmlUtil;
import com.hfkj.config.device.SoundService;
import com.hfkj.entity.BsDevice;
import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderMsg;
import com.hfkj.entity.BsTradeOrderProfitSharing;
import com.hfkj.entity.*;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.BsTradeOrderMsgService;
import com.hfkj.service.BsTradeOrderProfitSharingService;
import com.hfkj.service.BsTradeOrderService;
import com.hfkj.service.rebate.BsRebateMerAccountOrderServer;
import com.hfkj.sysenum.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -58,6 +56,8 @@ public class WeiXinController {
@Resource
private BsTradeOrderProfitSharingService tradeOrderProfitSharingService;
@Resource
private BsRebateMerAccountOrderServer rebateMerAccountOrderServer;
@RequestMapping(value="/jsapiPay",method = RequestMethod.POST)
@ResponseBody
@ -97,6 +97,39 @@ public class WeiXinController {
}
}
@RequestMapping(value="/rebateMerAccountOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "交易【主扫】通知")
public void rebateMerAccountOrder(HttpServletRequest request, HttpServletResponse response){
try {
log.info("微信支付 -> 异步通知:处理开始");
String resXml = "<xml> <return_code><![CDATA[SUCCESS]]></return_code>" +
" <return_msg><![CDATA[OK]]></return_msg> </xml> ";
String notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
log.info("微信支付 -> 异步通知数据:", notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
// 请求记录
BsTradeOrderMsg orderMsg = new BsTradeOrderMsg();
orderMsg.setOutTradeNo(map.get("out_trade_no"));
orderMsg.setType(TradeOrderMsgTypeEnum.type2.getNumber());
orderMsg.setResponseContent(notifyXml);
tradeOrderMsgService.editTradeOrderMsg(orderMsg);
if ("SUCCESS".equals(map.get("return_code")) && "SUCCESS".equals(map.get("result_code"))) {
}
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(resXml.getBytes());
out.flush();
out.close();
log.info("微信支付 -> 异步通知:处理完成");
} catch (Exception e) {
log.error("login error!",e);
}
}
@RequestMapping(value="/test",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "交易【主扫】通知")

@ -44,17 +44,17 @@ public interface BsRebateMerAccountOrderMapper extends BsRebateMerAccountOrderMa
"mer_abbreviate, order_type, ",
"order_no, trade_price, ",
"pay_type, pay_serial_no, ",
"pay_time, `status`, ",
"create_time, update_time, ",
"`status`, ext_1, ext_2, ",
"ext_3)",
"ext_1, ext_2, ext_3)",
"values (#{accountNumber,jdbcType=BIGINT}, #{merId,jdbcType=BIGINT}, ",
"#{merNo,jdbcType=VARCHAR}, #{merName,jdbcType=VARCHAR}, ",
"#{merAbbreviate,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, ",
"#{orderNo,jdbcType=VARCHAR}, #{tradePrice,jdbcType=DECIMAL}, ",
"#{payType,jdbcType=VARCHAR}, #{paySerialNo,jdbcType=VARCHAR}, ",
"#{payTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
"#{ext3,jdbcType=VARCHAR})"
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsRebateMerAccountOrder record);
@ -76,9 +76,10 @@ public interface BsRebateMerAccountOrderMapper extends BsRebateMerAccountOrderMa
@Result(column="trade_price", property="tradePrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
@ -88,8 +89,8 @@ public interface BsRebateMerAccountOrderMapper extends BsRebateMerAccountOrderMa
@Select({
"select",
"id, account_number, mer_id, mer_no, mer_name, mer_abbreviate, order_type, order_no, ",
"trade_price, pay_type, pay_serial_no, create_time, update_time, `status`, ext_1, ",
"ext_2, ext_3",
"trade_price, pay_type, pay_serial_no, pay_time, `status`, create_time, update_time, ",
"ext_1, ext_2, ext_3",
"from bs_rebate_mer_account_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -105,9 +106,10 @@ public interface BsRebateMerAccountOrderMapper extends BsRebateMerAccountOrderMa
@Result(column="trade_price", property="tradePrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
@ -135,9 +137,10 @@ public interface BsRebateMerAccountOrderMapper extends BsRebateMerAccountOrderMa
"trade_price = #{tradePrice,jdbcType=DECIMAL},",
"pay_type = #{payType,jdbcType=VARCHAR},",
"pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},",
"pay_time = #{payTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",

@ -68,6 +68,14 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.VALUES("pay_serial_no", "#{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getPayTime() != null) {
sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -76,10 +84,6 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
@ -112,9 +116,10 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.SELECT("trade_price");
sql.SELECT("pay_type");
sql.SELECT("pay_serial_no");
sql.SELECT("pay_time");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("`status`");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
@ -179,6 +184,14 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
}
if (record.getPayTime() != null) {
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -187,10 +200,6 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
@ -222,9 +231,10 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.SET("trade_price = #{record.tradePrice,jdbcType=DECIMAL}");
sql.SET("pay_type = #{record.payType,jdbcType=VARCHAR}");
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
@ -278,6 +288,14 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.SET("pay_serial_no = #{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getPayTime() != null) {
sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
@ -286,10 +304,6 @@ public class BsRebateMerAccountOrderSqlProvider {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}

@ -1,7 +1,27 @@
package com.hfkj.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface BsRebatePartMerMapperExt {
}
@Select(" <script>" +
" select " +
" id merId," +
" mer_no merNo," +
" mer_name merName," +
" mer_abbreviate merAbbreviate " +
" from bs_mer where id not in (select mer_id from bs_rebate_part_mer where `status` <![CDATA[ <> 0 ]]> ) and mer_status = 1" +
" <if test='param.merNo != null'> mer_no CONCAT('%', #{param.merNo} , '%') </if>" +
" <if test='param.merName != null'> mer_name CONCAT('%', #{param.merName} , '%') </if>" +
" <if test='param.merAbbreviate != null'> mer_abbreviate CONCAT('%', #{param.merAbbreviate} , '%') </if>" +
" ORDER BY create_time desc" +
" </script>")
List<Map<String,Object>> queryNotPartMer(@Param("param") Map<String,Object> param);
}

@ -72,6 +72,16 @@ public class BsRebateMerAccountOrder implements Serializable {
*/
private String paySerialNo;
/**
* 支付时间
*/
private Date payTime;
/**
* 状态 0不可用 1待支付 2已支付 3已退款
*/
private Integer status;
/**
* 创建时间
*/
@ -82,11 +92,6 @@ public class BsRebateMerAccountOrder implements Serializable {
*/
private Date updateTime;
/**
* 状态 0不可用 1待支付 2已支付 3已退款
*/
private Integer status;
private String ext1;
private String ext2;
@ -183,6 +188,22 @@ public class BsRebateMerAccountOrder implements Serializable {
this.paySerialNo = paySerialNo;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
@ -199,14 +220,6 @@ public class BsRebateMerAccountOrder implements Serializable {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getExt1() {
return ext1;
}
@ -254,9 +267,10 @@ public class BsRebateMerAccountOrder implements Serializable {
&& (this.getTradePrice() == null ? other.getTradePrice() == null : this.getTradePrice().equals(other.getTradePrice()))
&& (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType()))
&& (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo()))
&& (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
@ -277,9 +291,10 @@ public class BsRebateMerAccountOrder implements Serializable {
result = prime * result + ((getTradePrice() == null) ? 0 : getTradePrice().hashCode());
result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode());
result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode());
result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
@ -303,9 +318,10 @@ public class BsRebateMerAccountOrder implements Serializable {
sb.append(", tradePrice=").append(tradePrice);
sb.append(", payType=").append(payType);
sb.append(", paySerialNo=").append(paySerialNo);
sb.append(", payTime=").append(payTime);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", status=").append(status);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);

@ -846,6 +846,126 @@ public class BsRebateMerAccountOrderExample {
return (Criteria) this;
}
public Criteria andPayTimeIsNull() {
addCriterion("pay_time is null");
return (Criteria) this;
}
public Criteria andPayTimeIsNotNull() {
addCriterion("pay_time is not null");
return (Criteria) this;
}
public Criteria andPayTimeEqualTo(Date value) {
addCriterion("pay_time =", value, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeNotEqualTo(Date value) {
addCriterion("pay_time <>", value, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeGreaterThan(Date value) {
addCriterion("pay_time >", value, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeGreaterThanOrEqualTo(Date value) {
addCriterion("pay_time >=", value, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeLessThan(Date value) {
addCriterion("pay_time <", value, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeLessThanOrEqualTo(Date value) {
addCriterion("pay_time <=", value, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeIn(List<Date> values) {
addCriterion("pay_time in", values, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeNotIn(List<Date> values) {
addCriterion("pay_time not in", values, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeBetween(Date value1, Date value2) {
addCriterion("pay_time between", value1, value2, "payTime");
return (Criteria) this;
}
public Criteria andPayTimeNotBetween(Date value1, Date value2) {
addCriterion("pay_time not between", value1, value2, "payTime");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
@ -966,66 +1086,6 @@ public class BsRebateMerAccountOrderExample {
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andExt1IsNull() {
addCriterion("ext_1 is null");
return (Criteria) this;

@ -25,6 +25,13 @@ public interface BsRebateMerAccountOrderServer {
*/
BsRebateMerAccountOrder getDetailByOrderNo(String orderNo);
/**
* 支付成功
* @param orderNo 交易订单号
* @param paySerialNo 支付流水号
*/
void paySuccess(String orderNo,String paySerialNo);
/**
* 查询订单列表
* @param param

@ -57,4 +57,11 @@ public interface BsRebatePartMerService {
*/
List<BsRebatePartMer> getMerList(Map<String,Object> param);
/**
* 查询未参加的商户
* @param param
* @return
*/
List<Map<String,Object>> getNotPartMerList(Map<String,Object> param);
}

@ -1,20 +1,30 @@
package com.hfkj.service.rebate.impl;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsRebateMerAccountOrderMapper;
import com.hfkj.dao.BsRebatePartMerMapper;
import com.hfkj.entity.BsRebateMerAccount;
import com.hfkj.entity.BsRebateMerAccountOrder;
import com.hfkj.entity.BsRebateMerAccountOrderExample;
import com.hfkj.service.rebate.BsRebateMerAccountOrderServer;
import com.hfkj.service.rebate.BsRebateMerAccountService;
import com.hfkj.service.rebate.BsRebatePartMerService;
import com.hfkj.sysenum.RebatePartMerStatusEnum;
import com.hfkj.service.rebate.model.RebateMerAccountTradeObject;
import com.hfkj.sysenum.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @className: BsRebateMerAccountOrderServerImpl
@ -26,6 +36,10 @@ public class BsRebateMerAccountOrderServerImpl implements BsRebateMerAccountOrde
@Resource
private BsRebateMerAccountOrderMapper rebateMerAccountOrderMapper;
@Resource
private BsRebateMerAccountService rebateMerAccountService;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override
public void editData(BsRebateMerAccountOrder order) {
@ -50,6 +64,43 @@ public class BsRebateMerAccountOrderServerImpl implements BsRebateMerAccountOrde
return null;
}
@Override
public void paySuccess(String orderNo, String paySerialNo) {
String lockKey = "REBATE_ORDER_"+orderNo;
try {
// 占坑锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, null);
if(lock) {
BsRebateMerAccountOrder accountOrder = getDetailByOrderNo(orderNo);
if (accountOrder != null && accountOrder.getStatus().equals(RebateMerAccountOrderStatus.status1.getNumber())) {
accountOrder.setPaySerialNo(paySerialNo);
accountOrder.setPayTime(new Date());
accountOrder.setStatus(RebateMerAccountOrderStatus.status2.getNumber());
editData(accountOrder);
RebateMerAccountTradeObject accountTradeObject = new RebateMerAccountTradeObject();
accountTradeObject.setTradeObjectType(RebateMerAccountObjectTypeEnum.type1);
accountTradeObject.setTradeObjectId(accountOrder.getId());
accountTradeObject.setTradeObjectContent(Objects.requireNonNull(TradeOrderPayModeEnum.getNameByCode(accountOrder.getPayType())).getName()+"充值:" + accountTradeObject.getTradeObjectContent() + "元");
rebateMerAccountService.income(accountOrder.getAccountNumber(),accountOrder.getTradePrice(),accountTradeObject);
}
} else {
// 加锁失败,重试
Thread.sleep(100);
paySuccess(orderNo, paySerialNo);
}
} catch (BaseException baseException) {
redisTemplate.delete(lockKey);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, baseException.getErrorMsg());
} catch (Exception e) {
redisTemplate.delete(lockKey);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败!未知错误");
}
}
@Override
public List<BsRebateMerAccountOrder> getOrderList(Map<String, Object> param) {
BsRebateMerAccountOrderExample example = new BsRebateMerAccountOrderExample();

@ -139,4 +139,9 @@ public class BsRebatePartMerServiceImpl implements BsRebatePartMerService {
example.setOrderByClause("create_time desc");
return rebatePartMerMapper.selectByExample(example);
}
@Override
public List<Map<String,Object>> getNotPartMerList(Map<String, Object> param) {
return rebatePartMerMapper.queryNotPartMer(param);
}
}

Loading…
Cancel
Save