提交代码

dev
胡锐 6 months ago
parent fb826eaada
commit d7985fdcdb
  1. 1
      order/src/main/java/com/order/config/AuthConfig.java
  2. 100
      order/src/main/java/com/order/controller/notify/CqNotifyController.java
  3. 97
      schedule/src/main/java/com/hfkj/schedule/CouponSchedule.java
  4. 18
      service/src/main/java/com/hfkj/dao/BsOrderCouponNoMapper.java
  5. 28
      service/src/main/java/com/hfkj/dao/BsOrderCouponNoSqlProvider.java
  6. 36
      service/src/main/java/com/hfkj/entity/BsOrderCouponNo.java
  7. 130
      service/src/main/java/com/hfkj/entity/BsOrderCouponNoExample.java
  8. 15
      service/src/main/java/com/hfkj/service/coupon/BsOrderCouponNoService.java
  9. 7
      service/src/main/java/com/hfkj/service/coupon/BsOrderCouponService.java
  10. 35
      service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponNoServiceImpl.java
  11. 5
      service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponServiceImpl.java
  12. 7
      service/src/main/java/com/hfkj/service/order/BsOrderChildService.java
  13. 6
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  14. 2
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  15. 4
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  16. 8
      service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java
  17. 25
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java

@ -87,6 +87,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/**/springfox-swagger-ui/**")
.excludePathPatterns("/**/swagger-ui.html")
.excludePathPatterns("/notify/*")
.excludePathPatterns("/cqNotify/*")
;
}

@ -0,0 +1,100 @@
package com.order.controller.notify;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.AESTool;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.MD5Util;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderCoupon;
import com.hfkj.entity.BsOrderCouponNo;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.channel.ChongQingCNPCCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/cqNotify")
@Api(value = "重庆业务通知")
public class CqNotifyController {
private static final Logger log = LoggerFactory.getLogger(CqNotifyController.class);
@Resource
private BsOrderCouponNoService orderCouponNoService;
@RequestMapping(value = "/cqCnpcNotify", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "重庆中石油通知")
public Object cqCnpcNotify(@RequestBody String paramsStr) {
System.out.println(paramsStr);
log.info("重庆中石油核销通知");
log.info("通知参数:" + paramsStr);
try {
if (StringUtils.isNotBlank(paramsStr)) {
JSONObject sendMessage = JSONObject.parseObject(paramsStr).getJSONObject("sendMessage");
JSONObject body = ChongQingCNPCCouponService.decryptBody(sendMessage.getString("body"));
// 查询卡密
BsOrderCouponNo coupon = orderCouponNoService.getDetailByCouNo(body.getString("couponNo"));
if (coupon != null) {
coupon.setFinishTime(DateUtil.format(body.getString("useTime"), "yyyyMMddHHmmss"));
coupon.setStatus(40);
orderCouponNoService.editData(coupon);
}
Map<String, Object> param = new HashMap<>();
param.put("status", 1);
param.put("msg", "成功");
String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey());
Map<String, Object> returnContent = new HashMap<>();
Map<String, Object> returnPostMessage = new HashMap<>();
Map<String, Object> returnHead = new HashMap<>();
returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase());
returnHead.put("requestType", "couponNotice");
returnPostMessage.put("head", returnHead);
returnPostMessage.put("body", verifyCode);
returnContent.put("postMessage", returnPostMessage);
return returnContent;
} else {
Map<String, Object> param = new HashMap<>();
param.put("status", 0);
param.put("msg", "解析参数错误");
String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey());
Map<String, Object> returnContent = new HashMap<>();
Map<String, Object> returnPostMessage = new HashMap<>();
Map<String, Object> returnHead = new HashMap<>();
returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase());
returnHead.put("requestType", "couponNotice");
returnPostMessage.put("head", returnHead);
returnPostMessage.put("body", verifyCode);
returnContent.put("postMessage", returnPostMessage);
return returnContent;
}
} catch (Exception e) {
log.info("重庆中石油核销通知业务出现异常", e);
return null;
// return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,97 @@
package com.hfkj.schedule;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.BsOrderCoupon;
import com.hfkj.entity.BsOrderCouponNo;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.HuiLianTongCouponService;
import com.hfkj.service.coupon.channel.PetroConfig;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.GoodsVpdSourceEnum;
import com.hfkj.sysenum.order.OrderCouponNoStatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Auther: 胡锐
* @Description: 卡卷定时任务
* @Date: 2021/3/27 15:39
*/
@Configuration
public class CouponSchedule {
private static Logger log = LoggerFactory.getLogger(CouponSchedule.class);
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsOrderService orderService;
@Resource
BsOrderCouponService orderCouponService;
@Resource
private BsOrderCouponNoService orderCouponNoService;
//每日凌晨12点5秒执行一次
@Scheduled(cron = "5 0 0 * * ?")
public void expiredCoupon() {
Map<String,Object> param = new HashMap<>();
param.put("status", OrderCouponNoStatusEnum.status2.getCode());
param.put("expireStatus", false);
param.put("exceptionStatus", false);
// 查询卡密
List<BsOrderCouponNo> list = orderCouponNoService.getList(param);
for (BsOrderCouponNo coupon : list) {
try {
if (coupon.getGoodsVpdSource().equals(GoodsVpdSourceEnum.type4.getCode())) {
// 渠道查询
JSONObject jsonObject = HuiLianTongCouponService.getPayOrderByCouNo(coupon.getGoodsVpdSourceCouNo());
if (jsonObject.getString("respCode").equals("0000")) {
// 解析数据
JSONObject data = HuiLianTongUnionCardService.resolveResponse(jsonObject.getString("data"));
if (data.getString("respCode").equals("0000")) {
JSONObject responseObject = JSONObject.parseObject(data.getString("data"));
if (responseObject.getInteger("state") == 40) {
coupon.setStatus(OrderCouponNoStatusEnum.status3.getCode());
coupon.setFinishTime(new Date());
orderCouponNoService.editData(coupon);
}
}
}
} else if (coupon.getGoodsVpdSource().equals(GoodsVpdSourceEnum.type5.getCode())) {
} else if (coupon.getGoodsVpdSource().equals(GoodsVpdSourceEnum.type7.getCode())) {
} else if (coupon.getGoodsVpdSource().equals(GoodsVpdSourceEnum.type10.getCode())) {
// 查询卡券订单
BsOrderCoupon orderCoupon = orderCouponService.getDetail(coupon.getCouponOrderId());
if (orderCoupon != null) {
JSONObject jsonObject = PetroConfig.couponDetail(coupon.getGoodsVpdSourceCouNo(), orderCoupon.getUserPhone());
if (jsonObject.getString("resultCode").equals("0000")) {
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject jsonData = JSONObject.parseObject(data);
if (jsonData.getInteger("state") == 40) {
coupon.setStatus(OrderCouponNoStatusEnum.status3.getCode());
coupon.setFinishTime(jsonData.getDate("usedTime"));
orderCouponNoService.editData(coupon);
}
}
}
}
} catch (Exception e) {
}
}
}
}

@ -40,14 +40,16 @@ public interface BsOrderCouponNoMapper extends BsOrderCouponNoMapperExt {
@Insert({
"insert into bs_order_coupon_no (coupon_order_id, order_no, ",
"channel_order_no, goods_vpd_source_cou_no, ",
"channel_order_no, goods_vpd_source, ",
"goods_vpd_key, goods_vpd_source_cou_no, ",
"expire_status, expire_time, ",
"`status`, exception_status, ",
"create_time, deliver_time, ",
"finish_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{couponOrderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ",
"#{channelOrderNo,jdbcType=VARCHAR}, #{goodsVpdSourceCouNo,jdbcType=VARCHAR}, ",
"#{channelOrderNo,jdbcType=VARCHAR}, #{goodsVpdSource,jdbcType=INTEGER}, ",
"#{goodsVpdKey,jdbcType=VARCHAR}, #{goodsVpdSourceCouNo,jdbcType=VARCHAR}, ",
"#{expireStatus,jdbcType=BIT}, #{expireTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{exceptionStatus,jdbcType=BIT}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{deliverTime,jdbcType=TIMESTAMP}, ",
@ -67,6 +69,8 @@ public interface BsOrderCouponNoMapper extends BsOrderCouponNoMapperExt {
@Result(column="coupon_order_id", property="couponOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="channel_order_no", property="channelOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="goods_vpd_source", property="goodsVpdSource", jdbcType=JdbcType.INTEGER),
@Result(column="goods_vpd_key", property="goodsVpdKey", jdbcType=JdbcType.VARCHAR),
@Result(column="goods_vpd_source_cou_no", property="goodsVpdSourceCouNo", jdbcType=JdbcType.VARCHAR),
@Result(column="expire_status", property="expireStatus", jdbcType=JdbcType.BIT),
@Result(column="expire_time", property="expireTime", jdbcType=JdbcType.TIMESTAMP),
@ -84,9 +88,9 @@ public interface BsOrderCouponNoMapper extends BsOrderCouponNoMapperExt {
@Select({
"select",
"id, coupon_order_id, order_no, channel_order_no, goods_vpd_source_cou_no, expire_status, ",
"expire_time, `status`, exception_status, create_time, deliver_time, finish_time, ",
"update_time, ext_1, ext_2, ext_3",
"id, coupon_order_id, order_no, channel_order_no, goods_vpd_source, goods_vpd_key, ",
"goods_vpd_source_cou_no, expire_status, expire_time, `status`, exception_status, ",
"create_time, deliver_time, finish_time, update_time, ext_1, ext_2, ext_3",
"from bs_order_coupon_no",
"where id = #{id,jdbcType=BIGINT}"
})
@ -95,6 +99,8 @@ public interface BsOrderCouponNoMapper extends BsOrderCouponNoMapperExt {
@Result(column="coupon_order_id", property="couponOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="channel_order_no", property="channelOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="goods_vpd_source", property="goodsVpdSource", jdbcType=JdbcType.INTEGER),
@Result(column="goods_vpd_key", property="goodsVpdKey", jdbcType=JdbcType.VARCHAR),
@Result(column="goods_vpd_source_cou_no", property="goodsVpdSourceCouNo", jdbcType=JdbcType.VARCHAR),
@Result(column="expire_status", property="expireStatus", jdbcType=JdbcType.BIT),
@Result(column="expire_time", property="expireTime", jdbcType=JdbcType.TIMESTAMP),
@ -124,6 +130,8 @@ public interface BsOrderCouponNoMapper extends BsOrderCouponNoMapperExt {
"set coupon_order_id = #{couponOrderId,jdbcType=BIGINT},",
"order_no = #{orderNo,jdbcType=VARCHAR},",
"channel_order_no = #{channelOrderNo,jdbcType=VARCHAR},",
"goods_vpd_source = #{goodsVpdSource,jdbcType=INTEGER},",
"goods_vpd_key = #{goodsVpdKey,jdbcType=VARCHAR},",
"goods_vpd_source_cou_no = #{goodsVpdSourceCouNo,jdbcType=VARCHAR},",
"expire_status = #{expireStatus,jdbcType=BIT},",
"expire_time = #{expireTime,jdbcType=TIMESTAMP},",

@ -40,6 +40,14 @@ public class BsOrderCouponNoSqlProvider {
sql.VALUES("channel_order_no", "#{channelOrderNo,jdbcType=VARCHAR}");
}
if (record.getGoodsVpdSource() != null) {
sql.VALUES("goods_vpd_source", "#{goodsVpdSource,jdbcType=INTEGER}");
}
if (record.getGoodsVpdKey() != null) {
sql.VALUES("goods_vpd_key", "#{goodsVpdKey,jdbcType=VARCHAR}");
}
if (record.getGoodsVpdSourceCouNo() != null) {
sql.VALUES("goods_vpd_source_cou_no", "#{goodsVpdSourceCouNo,jdbcType=VARCHAR}");
}
@ -101,6 +109,8 @@ public class BsOrderCouponNoSqlProvider {
sql.SELECT("coupon_order_id");
sql.SELECT("order_no");
sql.SELECT("channel_order_no");
sql.SELECT("goods_vpd_source");
sql.SELECT("goods_vpd_key");
sql.SELECT("goods_vpd_source_cou_no");
sql.SELECT("expire_status");
sql.SELECT("expire_time");
@ -146,6 +156,14 @@ public class BsOrderCouponNoSqlProvider {
sql.SET("channel_order_no = #{record.channelOrderNo,jdbcType=VARCHAR}");
}
if (record.getGoodsVpdSource() != null) {
sql.SET("goods_vpd_source = #{record.goodsVpdSource,jdbcType=INTEGER}");
}
if (record.getGoodsVpdKey() != null) {
sql.SET("goods_vpd_key = #{record.goodsVpdKey,jdbcType=VARCHAR}");
}
if (record.getGoodsVpdSourceCouNo() != null) {
sql.SET("goods_vpd_source_cou_no = #{record.goodsVpdSourceCouNo,jdbcType=VARCHAR}");
}
@ -206,6 +224,8 @@ public class BsOrderCouponNoSqlProvider {
sql.SET("coupon_order_id = #{record.couponOrderId,jdbcType=BIGINT}");
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("channel_order_no = #{record.channelOrderNo,jdbcType=VARCHAR}");
sql.SET("goods_vpd_source = #{record.goodsVpdSource,jdbcType=INTEGER}");
sql.SET("goods_vpd_key = #{record.goodsVpdKey,jdbcType=VARCHAR}");
sql.SET("goods_vpd_source_cou_no = #{record.goodsVpdSourceCouNo,jdbcType=VARCHAR}");
sql.SET("expire_status = #{record.expireStatus,jdbcType=BIT}");
sql.SET("expire_time = #{record.expireTime,jdbcType=TIMESTAMP}");
@ -240,6 +260,14 @@ public class BsOrderCouponNoSqlProvider {
sql.SET("channel_order_no = #{channelOrderNo,jdbcType=VARCHAR}");
}
if (record.getGoodsVpdSource() != null) {
sql.SET("goods_vpd_source = #{goodsVpdSource,jdbcType=INTEGER}");
}
if (record.getGoodsVpdKey() != null) {
sql.SET("goods_vpd_key = #{goodsVpdKey,jdbcType=VARCHAR}");
}
if (record.getGoodsVpdSourceCouNo() != null) {
sql.SET("goods_vpd_source_cou_no = #{goodsVpdSourceCouNo,jdbcType=VARCHAR}");
}

@ -33,6 +33,16 @@ public class BsOrderCouponNo implements Serializable {
*/
private String channelOrderNo;
/**
* 商品虚拟来源
*/
private Integer goodsVpdSource;
/**
* 商品虚拟key
*/
private String goodsVpdKey;
/**
* 商品虚拟来源卡券编号
*/
@ -49,12 +59,12 @@ public class BsOrderCouponNo implements Serializable {
private Date expireTime;
/**
* 状态 1未派发 2已派发 3已使用 4已过期
* 状态 1未派发 2已派发 3已使用 4已过期 5已退款
*/
private Integer status;
/**
* 异常状态 0异常 1
* 异常状态 0正常 1
*/
private Boolean exceptionStatus;
@ -118,6 +128,22 @@ public class BsOrderCouponNo implements Serializable {
this.channelOrderNo = channelOrderNo;
}
public Integer getGoodsVpdSource() {
return goodsVpdSource;
}
public void setGoodsVpdSource(Integer goodsVpdSource) {
this.goodsVpdSource = goodsVpdSource;
}
public String getGoodsVpdKey() {
return goodsVpdKey;
}
public void setGoodsVpdKey(String goodsVpdKey) {
this.goodsVpdKey = goodsVpdKey;
}
public String getGoodsVpdSourceCouNo() {
return goodsVpdSourceCouNo;
}
@ -230,6 +256,8 @@ public class BsOrderCouponNo implements Serializable {
&& (this.getCouponOrderId() == null ? other.getCouponOrderId() == null : this.getCouponOrderId().equals(other.getCouponOrderId()))
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getChannelOrderNo() == null ? other.getChannelOrderNo() == null : this.getChannelOrderNo().equals(other.getChannelOrderNo()))
&& (this.getGoodsVpdSource() == null ? other.getGoodsVpdSource() == null : this.getGoodsVpdSource().equals(other.getGoodsVpdSource()))
&& (this.getGoodsVpdKey() == null ? other.getGoodsVpdKey() == null : this.getGoodsVpdKey().equals(other.getGoodsVpdKey()))
&& (this.getGoodsVpdSourceCouNo() == null ? other.getGoodsVpdSourceCouNo() == null : this.getGoodsVpdSourceCouNo().equals(other.getGoodsVpdSourceCouNo()))
&& (this.getExpireStatus() == null ? other.getExpireStatus() == null : this.getExpireStatus().equals(other.getExpireStatus()))
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
@ -252,6 +280,8 @@ public class BsOrderCouponNo implements Serializable {
result = prime * result + ((getCouponOrderId() == null) ? 0 : getCouponOrderId().hashCode());
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getChannelOrderNo() == null) ? 0 : getChannelOrderNo().hashCode());
result = prime * result + ((getGoodsVpdSource() == null) ? 0 : getGoodsVpdSource().hashCode());
result = prime * result + ((getGoodsVpdKey() == null) ? 0 : getGoodsVpdKey().hashCode());
result = prime * result + ((getGoodsVpdSourceCouNo() == null) ? 0 : getGoodsVpdSourceCouNo().hashCode());
result = prime * result + ((getExpireStatus() == null) ? 0 : getExpireStatus().hashCode());
result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
@ -277,6 +307,8 @@ public class BsOrderCouponNo implements Serializable {
sb.append(", couponOrderId=").append(couponOrderId);
sb.append(", orderNo=").append(orderNo);
sb.append(", channelOrderNo=").append(channelOrderNo);
sb.append(", goodsVpdSource=").append(goodsVpdSource);
sb.append(", goodsVpdKey=").append(goodsVpdKey);
sb.append(", goodsVpdSourceCouNo=").append(goodsVpdSourceCouNo);
sb.append(", expireStatus=").append(expireStatus);
sb.append(", expireTime=").append(expireTime);

@ -385,6 +385,136 @@ public class BsOrderCouponNoExample {
return (Criteria) this;
}
public Criteria andGoodsVpdSourceIsNull() {
addCriterion("goods_vpd_source is null");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceIsNotNull() {
addCriterion("goods_vpd_source is not null");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceEqualTo(Integer value) {
addCriterion("goods_vpd_source =", value, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceNotEqualTo(Integer value) {
addCriterion("goods_vpd_source <>", value, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceGreaterThan(Integer value) {
addCriterion("goods_vpd_source >", value, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceGreaterThanOrEqualTo(Integer value) {
addCriterion("goods_vpd_source >=", value, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceLessThan(Integer value) {
addCriterion("goods_vpd_source <", value, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceLessThanOrEqualTo(Integer value) {
addCriterion("goods_vpd_source <=", value, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceIn(List<Integer> values) {
addCriterion("goods_vpd_source in", values, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceNotIn(List<Integer> values) {
addCriterion("goods_vpd_source not in", values, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceBetween(Integer value1, Integer value2) {
addCriterion("goods_vpd_source between", value1, value2, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceNotBetween(Integer value1, Integer value2) {
addCriterion("goods_vpd_source not between", value1, value2, "goodsVpdSource");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyIsNull() {
addCriterion("goods_vpd_key is null");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyIsNotNull() {
addCriterion("goods_vpd_key is not null");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyEqualTo(String value) {
addCriterion("goods_vpd_key =", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyNotEqualTo(String value) {
addCriterion("goods_vpd_key <>", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyGreaterThan(String value) {
addCriterion("goods_vpd_key >", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyGreaterThanOrEqualTo(String value) {
addCriterion("goods_vpd_key >=", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyLessThan(String value) {
addCriterion("goods_vpd_key <", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyLessThanOrEqualTo(String value) {
addCriterion("goods_vpd_key <=", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyLike(String value) {
addCriterion("goods_vpd_key like", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyNotLike(String value) {
addCriterion("goods_vpd_key not like", value, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyIn(List<String> values) {
addCriterion("goods_vpd_key in", values, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyNotIn(List<String> values) {
addCriterion("goods_vpd_key not in", values, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyBetween(String value1, String value2) {
addCriterion("goods_vpd_key between", value1, value2, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdKeyNotBetween(String value1, String value2) {
addCriterion("goods_vpd_key not between", value1, value2, "goodsVpdKey");
return (Criteria) this;
}
public Criteria andGoodsVpdSourceCouNoIsNull() {
addCriterion("goods_vpd_source_cou_no is null");
return (Criteria) this;

@ -3,6 +3,7 @@ package com.hfkj.service.coupon;
import com.hfkj.entity.BsOrderCouponNo;
import java.util.List;
import java.util.Map;
/**
* @className: BsOrderCouponNoService
@ -17,6 +18,13 @@ public interface BsOrderCouponNoService {
*/
void editData(BsOrderCouponNo data);
/**
* 查询详情
* @param couNo
* @return
*/
BsOrderCouponNo getDetailByCouNo(String couNo);
/**
* 查询列表
* @param couponOrderId
@ -24,4 +32,11 @@ public interface BsOrderCouponNoService {
*/
List<BsOrderCouponNo> getListByCouponOrderId(Long couponOrderId);
/**
* 查询列表
* @param param
* @return
*/
List<BsOrderCouponNo> getList(Map<String,Object> param);
}

@ -27,6 +27,13 @@ public interface BsOrderCouponService {
*/
BsOrderCoupon getDetailByChildOrderNo(String orderChildNo);
/**
* 查询详情
* @param id
* @return
*/
BsOrderCoupon getDetail(Long id);
/**
* 查询卡券订单
* @param param

@ -4,11 +4,13 @@ import com.hfkj.dao.BsOrderCouponNoMapper;
import com.hfkj.entity.BsOrderCouponNo;
import com.hfkj.entity.BsOrderCouponNoExample;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: BsOrderCouponNoServiceImpl
@ -30,10 +32,43 @@ public class BsOrderCouponNoServiceImpl implements BsOrderCouponNoService {
}
}
@Override
public BsOrderCouponNo getDetailByCouNo(String couNo) {
BsOrderCouponNoExample example = new BsOrderCouponNoExample();
example.createCriteria().andGoodsVpdSourceCouNoEqualTo(couNo);
List<BsOrderCouponNo> list = orderCouponNoMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public List<BsOrderCouponNo> getListByCouponOrderId(Long couponOrderId) {
BsOrderCouponNoExample example = new BsOrderCouponNoExample();
example.createCriteria().andCouponOrderIdEqualTo(couponOrderId);
example.setOrderByClause("create_time desc");
return orderCouponNoMapper.selectByExample(example);
}
@Override
public List<BsOrderCouponNo> getList(Map<String, Object> param) {
BsOrderCouponNoExample example = new BsOrderCouponNoExample();
BsOrderCouponNoExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}
if (MapUtils.getBoolean(param, "expireStatus") != null) {
criteria.andExpireStatusEqualTo(MapUtils.getBoolean(param, "expireStatus"));
}
if (MapUtils.getBoolean(param, "exceptionStatus") != null) {
criteria.andExceptionStatusEqualTo(MapUtils.getBoolean(param, "exceptionStatus"));
}
example.setOrderByClause("create_time desc");
return orderCouponNoMapper.selectByExample(example);
}
}

@ -47,6 +47,11 @@ public class BsOrderCouponServiceImpl implements BsOrderCouponService {
return null;
}
@Override
public BsOrderCoupon getDetail(Long id) {
return orderCouponMapper.selectByPrimaryKey(id);
}
@Override
public List<OrderCouponModel> getOrderList(Map<String, Object> param) {
if (MapUtils.getLong(param, "createTimeS") != null) {

@ -33,4 +33,11 @@ public interface BsOrderChildService {
*/
List<OrderChildModel> getOrderChildListByOrderNo(String orderNo);
/**
* 获取未完成的子订单数量
* @param orderNo
* @return
*/
long getUndoneChildOrder(String orderNo);
}

@ -49,6 +49,12 @@ public interface BsOrderService {
*/
OrderModel cancel(String orderNo, boolean system);
/**
* 子订单完成
* @param childOrderNo
*/
void childOrderComplete(String childOrderNo);
/**
* 支付成功业务
* @param order

@ -117,6 +117,8 @@ public class OrderCreateService {
BsOrderCouponNo orderCouponNo = new BsOrderCouponNo();
orderCouponNo.setCouponOrderId(orderCoupon.getId());
orderCouponNo.setOrderNo(orderCoupon.getId() + RandomUtils.number(6, false));
orderCouponNo.setGoodsVpdKey(orderCoupon.getGoodsVpdKey());
orderCouponNo.setGoodsVpdSource(orderCoupon.getGoodsVpdSource());
orderCouponNo.setExpireStatus(false);
orderCouponNo.setExceptionStatus(false);
orderCouponNo.setStatus(OrderCouponNoStatusEnum.status1.getCode());

@ -40,6 +40,8 @@ import java.util.List;
public class OrderPaySuccessService {
Logger log = LoggerFactory.getLogger(OrderPaySuccessService.class);
@Resource
private BsOrderService orderService;
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private BsOrderCouponService orderCouponService;
@ -179,6 +181,8 @@ public class OrderPaySuccessService {
couponNo.setGoodsVpdSourceCouNo(object.getString("couponCode"));
orderCouponNoService.editData(couponNo);
}
} catch (Exception e) {
couponNo.setExceptionStatus(true);
orderCouponService.editData(orderCoupon);

@ -11,6 +11,7 @@ import com.hfkj.model.order.OrderChildModel;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -88,4 +89,11 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
}
return orderChildModelList;
}
@Override
public long getUndoneChildOrder(String orderNo) {
BsOrderChildExample example = new BsOrderChildExample();
example.createCriteria().andOrderNoEqualTo(orderNo).andStatusNotEqualTo(OrderChildStatusEnum.status3.getCode());
return orderChildMapper.countByExample(example);
}
}

@ -379,6 +379,31 @@ public class BsOrderServiceImpl implements BsOrderService {
return order;
}
@Override
public void childOrderComplete(String childOrderNo) {
BsOrderChild orderChild = orderChildService.getDetail(childOrderNo);
if (orderChild == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 删除缓存
cacheDelete(orderChild.getOrderNo());
orderChild.setFinishTime(new Date());
orderChild.setStatus(OrderChildStatusEnum.status3.getCode());
orderChildService.editData(orderChild);
// 查询未完成的子订单数量
long count = orderChildService.getUndoneChildOrder(orderChild.getOrderNo());
if (count == 0) {
BsOrder order = getOrder(orderChild.getOrderNo());
if (order != null) {
order.setOrderStatus(OrderStatusEnum.status3.getCode());
order.setFinishTime(new Date());
editData(order);
}
}
}
@Override
public void orderPaySuccessHandle(OrderModel order) {
order.setPayTime(order.getPayTime()==null?new Date():order.getPayTime());

Loading…
Cancel
Save