'提交代码'

dev-discount
= 3 years ago
parent 75afddd25a
commit 0cea422dc5
  1. 1
      hai-cweb/src/main/java/com/cweb/controller/pay/TuanYouController.java
  2. 130
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  3. 102
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  4. 14
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  5. 12
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -84,6 +84,7 @@ public class TuanYouController {
if(orderRefundModel.getResult_code().equals("SUCCESS")) { if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setOrderStatus(4); order.setOrderStatus(4);
order.setRefundTime(new Date()); order.setRefundTime(new Date());
order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order); highOrderService.updateOrderDetail(order);
} }
} else if (!object.getBoolean("refundResult") == true && order != null) { } else if (!object.getBoolean("refundResult") == true && order != null) {

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
import com.hai.config.QianZhuConfig; import com.hai.config.QianZhuConfig;
import com.hai.config.WxOrderConfig; import com.hai.config.WxOrderConfig;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.model.OrderRefundModel; import com.hai.model.OrderRefundModel;
import com.hai.service.HighOrderService; import com.hai.service.HighOrderService;
@ -70,7 +71,9 @@ public class HighOrderSchedule {
// 订单状态 0:待付款 5:已支付 10:充值中 15:交易成功 -5:已取消 -10:充值失败 // 订单状态 0:待付款 5:已支付 10:充值中 15:交易成功 -5:已取消 -10:充值失败
if (data.getInteger("status") == 15) { if (data.getInteger("status") == 15) {
highOrder.getHighChildOrderList().get(0).setChildOrdeStatus(3); for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
highOrder.setOrderStatus(3); highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date()); highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder); highOrderService.updateOrder(highOrder);
@ -79,12 +82,135 @@ public class HighOrderSchedule {
if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) { if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) { if(orderRefundModel.getResult_code().equals("SUCCESS")) {
highOrder.getHighChildOrderList().get(0).setChildOrdeStatus(4); for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(4);
}
highOrder.setOrderStatus(4);
highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(highOrder.getPayRealPrice());
highOrderService.updateOrder(highOrder);
}
} else {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(5);
}
highOrder.setCancelTime(new Date());
highOrder.setOrderStatus(5);
highOrderService.updateOrder(highOrder);
}
}
}
}
} catch (Exception e) {
log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
}
}
}
}
/**
* @Author 胡锐
* @Description 处理话KFC订单
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void handleKfcOrder() {
List<HighOrder> orderList = highOrderService.getAlreadyPaidKfcOrder();
if (orderList != null && orderList.size() > 0) {
for (HighOrder order : orderList) {
try {
HighOrder highOrder = highOrderService.getOrderById(order.getId());
if (highOrder != null) {
JSONObject mobileOrderJson = QianZhuConfig.getKfcOrderByOrderNo(highOrder.getOrderNo());
if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
JSONObject data = mobileOrderJson.getJSONObject("data");
// 订单状态 0:待付款 5:排队中 15:TRAN_SUCCESS:交易成功 -5:已取消
if (data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
if (data.getInteger("status") == -5) {
if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(4);
}
highOrder.setOrderStatus(4); highOrder.setOrderStatus(4);
highOrder.setRefundTime(new Date()); highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrder.setRefundPrice(highOrder.getPayRealPrice());
highOrderService.updateOrder(highOrder); highOrderService.updateOrder(highOrder);
} }
} else {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(5);
}
highOrder.setCancelTime(new Date());
highOrder.setOrderStatus(5);
highOrderService.updateOrder(highOrder);
}
}
}
}
} catch (Exception e) {
log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
}
}
}
}
/**
* @Author 胡锐
* @Description 处理电影票订单
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void handleCinemaOrder() {
List<HighOrder> orderList = highOrderService.getAlreadyPaidCinemaOrder();
if (orderList != null && orderList.size() > 0) {
for (HighOrder order : orderList) {
try {
HighOrder highOrder = highOrderService.getOrderById(order.getId());
if (highOrder != null) {
JSONObject mobileOrderJson = QianZhuConfig.getCinemaOrderByOrderNo(highOrder.getOrderNo());
if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
JSONObject data = mobileOrderJson.getJSONObject("data");
// 订单状态 0:待付款 5:待出票 10:已出票 15:交易成功 -5:已取消
if (data.getInteger("status") == 10 || data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
if (data.getInteger("status") == -5) {
if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(4);
}
highOrder.setOrderStatus(4);
highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(highOrder.getPayRealPrice());
highOrderService.updateOrder(highOrder);
}
} else {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(5);
}
highOrder.setCancelTime(new Date());
highOrder.setOrderStatus(5);
highOrderService.updateOrder(highOrder);
} }
} }
} }

@ -340,7 +340,7 @@ public interface HighOrderMapperExt {
List<HighOrderModel> getMobileOrderList(@Param("map") Map<String,Object> map); List<HighOrderModel> getMobileOrderList(@Param("map") Map<String,Object> map);
/** /**
* 查询处于已经支付的话费订单 * 查询处于已经支付和待支付的话费订单
*/ */
@Select({"SELECT" + @Select({"SELECT" +
" b.*" + " b.*" +
@ -350,9 +350,9 @@ public interface HighOrderMapperExt {
" WHERE" + " WHERE" +
" a.order_id = b.id" + " a.order_id = b.id" +
" and a.goods_type = 6" + " and a.goods_type = 6" +
" and b.order_status = 2" + " and b.order_status in (1,2) " +
" and a.giveaway_type = 0" + " and a.giveaway_type = 0" +
" GROUP BY a.id ORDER BY b.create_time desc"}) " GROUP BY b.id"})
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@ -386,6 +386,102 @@ public interface HighOrderMapperExt {
}) })
List<HighOrder> selectAlreadyPaidMobileOrder(); List<HighOrder> selectAlreadyPaidMobileOrder();
/**
* 查询处于已经支付和待支付的KFC订单
*/
@Select({"SELECT " +
" b.*" +
" FROM" +
" high_child_order a," +
" high_order b" +
" WHERE" +
" a.order_id = b.id" +
" and a.goods_type = 4" +
" and b.order_status in (1,2) " +
" and a.giveaway_type = 0" +
" GROUP BY b.id"})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_model", property="payModel", jdbcType=JdbcType.INTEGER),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
@Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER),
@Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_remarks", property="cancelRemarks", jdbcType=JdbcType.VARCHAR),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR),
@Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR),
@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)
})
List<HighOrder> selectAlreadyPaidKfcOrder();
/**
* 查询处于已经支付和待支付的电影票订单
*/
@Select({"SELECT" +
" b.*" +
" FROM" +
" high_child_order a," +
" high_order b" +
" WHERE" +
" a.order_id = b.id" +
" and a.goods_type = 5" +
" and b.order_status in (1,2)" +
" and a.giveaway_type = 0" +
" GROUP BY b.id"})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_model", property="payModel", jdbcType=JdbcType.INTEGER),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
@Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER),
@Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_remarks", property="cancelRemarks", jdbcType=JdbcType.VARCHAR),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR),
@Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR),
@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)
})
List<HighOrder> selectAlreadyPaidCinemaOrder();
@Select({"select a.id orderId,b.id childOrderId from high_order a,high_child_order b where a.id = b.order_id and b.goods_type = 3 and a.order_status = 2 and TIMESTAMPDIFF(MINUTE,a.pay_time,SYSDATE()) > 60*24 GROUP BY b.id"}) @Select({"select a.id orderId,b.id childOrderId from high_order a,high_child_order b where a.id = b.order_id and b.goods_type = 3 and a.order_status = 2 and TIMESTAMPDIFF(MINUTE,a.pay_time,SYSDATE()) > 60*24 GROUP BY b.id"})
List<Map<String,Object>> selectFinishGasOrder(); List<Map<String,Object>> selectFinishGasOrder();

@ -193,11 +193,23 @@ public interface HighOrderService {
Integer countUnusedDiscountByUserId(Long userId , Integer status); Integer countUnusedDiscountByUserId(Long userId , Integer status);
/** /**
* 查询处于已经支付的话费订单 * 查询处于已经支付和待支付的话费订单
* @return * @return
*/ */
List<HighOrder> getAlreadyPaidMobileOrder(); List<HighOrder> getAlreadyPaidMobileOrder();
/**
* 查询处于已经支付和待支付的KFC订单
* @return
*/
List<HighOrder> getAlreadyPaidKfcOrder();
/**
* 查询处于已经支付和待支付的话费订单
* @return
*/
List<HighOrder> getAlreadyPaidCinemaOrder();
/** /**
* 查询团油超过支付时间24小时订单 * 查询团油超过支付时间24小时订单
* @return * @return

@ -124,6 +124,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder.setGoodsImg(coupon.getCouponImg()); highChildOrder.setGoodsImg(coupon.getCouponImg());
highChildOrder.setGoodsSpecName("默认"); highChildOrder.setGoodsSpecName("默认");
highChildOrder.setGoodsPrice(new BigDecimal(0)); highChildOrder.setGoodsPrice(new BigDecimal(0));
highChildOrder.setGoodsActualPrice(new BigDecimal("0"));
highChildOrder.setSaleCount(1); highChildOrder.setSaleCount(1);
highChildOrder.setTotalPrice(new BigDecimal(0)); highChildOrder.setTotalPrice(new BigDecimal(0));
highChildOrder.setGiveawayType(true); // 是否是赠品 0:否 1:是 highChildOrder.setGiveawayType(true); // 是否是赠品 0:否 1:是
@ -543,6 +544,17 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapperExt.selectAlreadyPaidMobileOrder(); return highOrderMapperExt.selectAlreadyPaidMobileOrder();
} }
@Override
public List<HighOrder> getAlreadyPaidKfcOrder() {
return highOrderMapperExt.selectAlreadyPaidKfcOrder();
}
@Override
public List<HighOrder> getAlreadyPaidCinemaOrder() {
return highOrderMapperExt.selectAlreadyPaidCinemaOrder();
}
@Override @Override
public List<Map<String, Object>> getFinishGasOrder() { public List<Map<String, Object>> getFinishGasOrder() {
return highOrderMapper.selectFinishGasOrder(); return highOrderMapper.selectFinishGasOrder();

Loading…
Cancel
Save