'提交代码'

dev-discount
= 3 years ago
parent 65d17e5c96
commit 1ff1fa6a21
  1. 52
      hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
  2. 4
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  3. 49
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  4. 17
      hai-service/src/main/java/com/hai/config/QianZhuConfig.java
  5. 104
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  6. 14
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  7. 21
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -393,5 +393,57 @@ public class HighOrderController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getMobileOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询话费充值订单列表")
public ResponseData getMobileOrderList(@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "merchantId", required = false) Long merchantId,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "paySerialNo", required = false) String paySerialNo,
@RequestParam(name = "payModel", required = false) Integer payModel,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "orderStatus", required = false) Integer orderStatus,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
// 用户来源 0:超级管理员 1:公司 2:商户 3:门店 4. 代理商
if(userInfoModel.getSecUser().getObjectType() == 0) {
map.put("companyId", companyId);
} else if (userInfoModel.getSecUser().getObjectType() == 1) {
map.put("companyId", userInfoModel.getBsCompany().getId());
map.put("merchantId", merchantId);
} else if (userInfoModel.getSecUser().getObjectType() == 2) {
map.put("merchantId", userInfoModel.getMerchant().getId());
}
map.put("orderNo", orderNo);
map.put("paySerialNo", paySerialNo);
map.put("payModel", payModel);
map.put("payType", payType);
map.put("orderStatus", orderStatus);
map.put("payTimeS", payTimeS);
map.put("payTimeE", payTimeE);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highOrderService.getMobileOrderList(map)));
} catch (Exception e) {
log.error("HighOrderController --> getGasOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -262,8 +262,8 @@ public class OrderController {
//微信支付
String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8");
// int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
int total_fee = 1;
int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
// int total_fee = 1;
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo();
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号

@ -2,7 +2,10 @@ package com.hai.schedule;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpsUtils;
import com.hai.config.QianZhuConfig;
import com.hai.config.WxOrderConfig;
import com.hai.entity.HighOrder;
import com.hai.model.OrderRefundModel;
import com.hai.service.HighOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -48,6 +51,52 @@ public class HighOrderSchedule {
}
}
/**
* @Author 胡锐
* @Description 处理话费充值订单
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void handleMobileOrder() {
List<HighOrder> orderList = highOrderService.getAlreadyPaidMobileOrder();
if (orderList != null && orderList.size() > 0) {
for (HighOrder order : orderList) {
try {
HighOrder highOrder = highOrderService.getOrderById(order.getId());
if (highOrder != null) {
JSONObject mobileOrderJson = QianZhuConfig.getMobileOrderByOrderNo(highOrder.getOrderNo());
if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
JSONObject data = mobileOrderJson.getJSONObject("data");
// 订单状态 0:待付款 5:已支付 10:充值中 15:交易成功 -5:已取消 -10:充值失败
if (data.getInteger("status") == 15) {
highOrder.getHighChildOrderList().get(0).setChildOrdeStatus(3);
highOrder.setOrderStatus(3);
highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(data.getBigDecimal("refundAmount"));
highOrderService.updateOrderDetail(highOrder);
}
if (data.getInteger("status") == -10 || 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")) {
highOrder.getHighChildOrderList().get(0).setChildOrdeStatus(4);
highOrder.setOrderStatus(4);
highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(highOrder.getPayRealPrice());
highOrderService.updateOrderDetail(highOrder);
}
}
}
}
}
} catch (Exception e) {
log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
}
}
}
}
/**
* @Author 胡锐
* @Description 完成团油订单 超过支付时间24小时订单自动完成

@ -111,7 +111,8 @@ public class QianZhuConfig {
/**
* 获取话费充值Token
* 话费充值
* 获取Token
* @param platformUniqueId 用户唯一id
* @param nickname 昵称
* @param mobile 电话号码
@ -134,6 +135,13 @@ public class QianZhuConfig {
return HttpsUtils.doPost("https://live.qianzhu8.com/gateway", JSON.toJSONString(map));
}
/**
* 话费订单
* 根据订单号查询
* @param orderNo 订单号
* @return
* @throws Exception
*/
public static JSONObject getMobileOrderByOrderNo(String orderNo) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("orderNo", orderNo);
@ -148,6 +156,13 @@ public class QianZhuConfig {
return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map));
}
/**
* 话费订单
* 支付订单
* @param orderNo
* @return
* @throws Exception
*/
public static JSONObject payMobileOrder(String orderNo) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("orderNo", orderNo);

@ -226,9 +226,9 @@ public interface HighOrderMapperExt {
" a.order_id = b.id" +
" and a.goods_type = 4" +
" and a.giveaway_type = 0" +
" and EXISTS (select 1 from high_merchant_store c where c.id = a.goods_id " +
/* " and EXISTS (select 1 from high_merchant_store c where c.id = a.goods_id " +
" <if test='map.companyId != null'> and c.company_id = #{map.companyId} </if> " +
" <if test='map.merchantId != null'> and c.merchant_id = #{map.merchantId} </if> )" +
" <if test='map.merchantId != null'> and c.merchant_id = #{map.merchantId} </if> )" +*/
" <if test='map.orderNo != null'> and b.order_no = #{map.orderNo}</if>",
" <if test='map.paySerialNo != null'> and b.pay_serial_no = #{map.paySerialNo} </if>",
" <if test='map.payModel != null'> and b.pay_model = #{map.payModel} </if>",
@ -276,9 +276,9 @@ public interface HighOrderMapperExt {
" a.order_id = b.id" +
" and a.goods_type = 5" +
" and a.giveaway_type = 0" +
" and EXISTS (select 1 from high_merchant_store c where c.id = a.goods_id " +
/* " and EXISTS (select 1 from high_merchant_store c where c.id = a.goods_id " +
" <if test='map.companyId != null'> and c.company_id = #{map.companyId} </if> " +
" <if test='map.merchantId != null'> and c.merchant_id = #{map.merchantId} </if> )" +
" <if test='map.merchantId != null'> and c.merchant_id = #{map.merchantId} </if> )" +*/
" <if test='map.orderNo != null'> and b.order_no = #{map.orderNo}</if>",
" <if test='map.paySerialNo != null'> and b.pay_serial_no = #{map.paySerialNo} </if>",
" <if test='map.payModel != null'> and b.pay_model = #{map.payModel} </if>",
@ -290,6 +290,102 @@ public interface HighOrderMapperExt {
"</script>"})
List<HighOrderModel> selectCinemaOrderList(@Param("map") Map<String,Object> map);
@Select({"<script>" +
" SELECT" +
" (select st.store_name from high_merchant_store st where st.id = a.goods_id) merchantName," +
" case a.goods_type when 1 then '卡券' when 2 then '金币充值' when 3 then '加油缴费' end goodsType," +
" b.id orderId, " +
" a.goods_name goodsName, " +
" a.goods_type goodsTypeId," +
" case a.giveaway_type when 1 then '赠送' when 0 then '购买' end giveawayType," +
" b.order_no orderNo," +
" b.mem_name memName," +
" b.mem_phone memPhone," +
" case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " +
" case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' end payType," +
" b.pay_serial_no paySerialNo," +
" case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," +
" b.mem_discount_name memDiscountName," +
" b.deduction_price deductionPrice," +
" case a.giveaway_type when 0 then case when b.pay_gold is null then 0 else pay_gold end when 1 then 0 end payGold," +
" case a.giveaway_type when 0 then b.pay_price when 1 then 0 end payPrice," +
" case a.giveaway_type when 0 then case when b.pay_gold is not null then convert(b.pay_gold / 100,decimal(10,2)) else b.pay_real_price end when 1 then 0 end payRealPrice," +
" case b.order_status when 1 then '待支付' when 2 then '已支付' when 3 then '已完成' when 4 then '已退款' when 5 then '已取消' when 6 then '退款中' when 7 then '退款失败' end orderStatus, " +
" b.order_status orderStatusId," +
" b.create_time createTime," +
" b.pay_time payTime," +
" b.cancel_time cancelTime," +
" b.refund_time refundTime," +
" b.refund_content refundContent," +
" b.refusal_refund_content refusalRefundContent" +
" FROM" +
" high_child_order a," +
" high_order b" +
" WHERE" +
" a.order_id = b.id" +
" and a.goods_type = 6" +
" and a.giveaway_type = 0" +
/* " and EXISTS (select 1 from high_merchant_store c where c.id = a.goods_id " +
" <if test='map.companyId != null'> and c.company_id = #{map.companyId} </if> " +
" <if test='map.merchantId != null'> and c.merchant_id = #{map.merchantId} </if> )" +*/
" <if test='map.orderNo != null'> and b.order_no = #{map.orderNo}</if>",
" <if test='map.paySerialNo != null'> and b.pay_serial_no = #{map.paySerialNo} </if>",
" <if test='map.payModel != null'> and b.pay_model = #{map.payModel} </if>",
" <if test='map.payType != null'> and b.pay_type = #{map.payType} </if>",
" <if test='map.orderStatus != null'> and b.order_status in (#{map.orderStatus}) </if>",
" <if test='map.payTimeS != null'> <![CDATA[ and b.pay_time >= #{map.payTimeS} ]]> </if>",
" <if test='map.payTimeE != null'> <![CDATA[ and b.pay_time <= #{map.payTimeE} ]]> </if>",
" GROUP BY a.id ORDER BY b.create_time desc" +
"</script>"})
List<HighOrderModel> getMobileOrderList(@Param("map") Map<String,Object> map);
/**
* 查询处于已经支付的话费订单
*/
@Select({"SELECT" +
" b.*" +
" FROM" +
" high_child_order a," +
" high_order b" +
" WHERE" +
" a.order_id = b.id" +
" and a.goods_type = 6" +
" and b.order_status = 2" +
" and a.giveaway_type = 0" +
" GROUP BY a.id ORDER BY b.create_time desc"})
@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> selectAlreadyPaidMobileOrder();
@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();

@ -142,6 +142,14 @@ public interface HighOrderService {
*/
List<HighOrderModel> getCinemaOrderList(Map<String,Object> map) throws Exception;
/**
* 查询话费充值订单
* @param map
* @return
* @throws Exception
*/
List<HighOrderModel> getMobileOrderList(Map<String,Object> map) throws Exception;
/**
* @Author 胡锐
* @Description 查询需要关闭的订单列表
@ -184,6 +192,12 @@ public interface HighOrderService {
**/
Integer countUnusedDiscountByUserId(Long userId , Integer status);
/**
* 查询处于已经支付的话费订单
* @return
*/
List<HighOrder> getAlreadyPaidMobileOrder();
/**
* 查询团油超过支付时间24小时订单
* @return

@ -409,6 +409,19 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapper.selectCinemaOrderList(map);
}
@Override
public List<HighOrderModel> getMobileOrderList(Map<String, Object> map) throws Exception {
if(MapUtils.getLong(map, "payTimeS") != null) {
map.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeS")), "yyyy-MM-dd HH:mm:ss"));
}
if(MapUtils.getLong(map, "payTimeE") != null) {
map.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeE")), "yyyy-MM-dd HH:mm:ss"));
}
return highOrderMapper.getMobileOrderList(map);
}
@Override
public List<HighOrder> getCloseOrder() {
return highOrderMapperExt.getCloseOrder();
@ -460,6 +473,9 @@ public class HighOrderServiceImpl implements HighOrderService {
public void cancelOrder(Long orderId) {
HighOrder order = getOrderById(orderId);
if (order != null) {
if (order.getOrderStatus() != 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
order.setOrderStatus(5); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
order.setCancelTime(new Date());
@ -522,6 +538,11 @@ public class HighOrderServiceImpl implements HighOrderService {
return highDiscountUserRelMapper.selectByExample(example).size();
}
@Override
public List<HighOrder> getAlreadyPaidMobileOrder() {
return highOrderMapperExt.selectAlreadyPaidMobileOrder();
}
@Override
public List<Map<String, Object>> getFinishGasOrder() {
return highOrderMapper.selectFinishGasOrder();

Loading…
Cancel
Save