parent
59da087d7f
commit
3c6ef38e73
@ -0,0 +1,75 @@ |
|||||||
|
package com.bweb.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hfkj.channel.gas.shell.CqShellPetroleumRequestService; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.utils.HttpUtils; |
||||||
|
import com.hfkj.common.utils.HttpsUtils; |
||||||
|
import com.hfkj.common.utils.MD5Util; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.entity.BsGasOrder; |
||||||
|
import com.hfkj.entity.SecUser; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.service.sec.SecUserLoginLogService; |
||||||
|
import com.hfkj.service.sec.SecUserService; |
||||||
|
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||||
|
import com.hfkj.sysenum.SecUserStatusEnum; |
||||||
|
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.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/test") |
||||||
|
@Api(value="测试") |
||||||
|
public class TestController { |
||||||
|
Logger log = LoggerFactory.getLogger(TestController.class); |
||||||
|
|
||||||
|
@Resource |
||||||
|
private SecUserService secUserService; |
||||||
|
@Resource |
||||||
|
private SecUserLoginLogService secUserLoginLogService; |
||||||
|
|
||||||
|
@RequestMapping(value="/editUser",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "编辑用户") |
||||||
|
public ResponseData editUser() { |
||||||
|
try { |
||||||
|
|
||||||
|
JSONObject response = HttpsUtils.doGet("https://oil.dctpay.com/crest/gasOrder/queryOilOrder?orderNo=240804110524374697"); |
||||||
|
|
||||||
|
BsGasOrder gasOrder = JSONObject.parseObject(response.getJSONObject("return_data").toJSONString(), BsGasOrder.class); |
||||||
|
|
||||||
|
// 推送加好油【重庆壳牌】
|
||||||
|
JSONObject object = CqShellPetroleumRequestService.gasSyncPayment(gasOrder.getOrderNo(), |
||||||
|
gasOrder.getMerNo(), |
||||||
|
gasOrder.getPayTime(), |
||||||
|
gasOrder.getGasRefuelPrice(), |
||||||
|
gasOrder.getGasOilNo(), |
||||||
|
gasOrder.getGasGunNo(), |
||||||
|
gasOrder.getPayablePrice(), |
||||||
|
gasOrder.getTotalDeductionPrice() |
||||||
|
); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(object); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.hfkj.schedule; |
||||||
|
|
||||||
|
import com.hfkj.service.order.BsOrderService; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 订单结算业务 |
||||||
|
* @className: OrderSettleService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/6/25 |
||||||
|
**/ |
||||||
|
@Component |
||||||
|
public class OrderSchedule { |
||||||
|
@Resource |
||||||
|
private BsOrderService orderService; |
||||||
|
|
||||||
|
@Scheduled(cron="0 0/1 * * * ?") //每分钟执行一次
|
||||||
|
public void cancel() { |
||||||
|
List<Map<String, Object>> orderList = orderService.getNeedCancelOrderList(); |
||||||
|
for (Map<String,Object> param : orderList) { |
||||||
|
try { |
||||||
|
// 取消订单
|
||||||
|
orderService.cancel(MapUtils.getString(param, "orderNo")); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
System.out.println(MapUtils.getString(param, "orderNo")+",取消订单失败!"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,7 +1,18 @@ |
|||||||
package com.hfkj.dao; |
package com.hfkj.dao; |
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
/** |
/** |
||||||
* mapper扩展类 |
* mapper扩展类 |
||||||
*/ |
*/ |
||||||
public interface BsOrderMapperExt { |
public interface BsOrderMapperExt { |
||||||
|
|
||||||
|
@Select(" select a.orderNo,a.timestampdiff " + |
||||||
|
" from (select order_no orderNo, TIMESTAMPDIFF(MINUTE,create_time,NOW()) timestampdiff from bs_order where order_status = 1) a " + |
||||||
|
" where a.timestampdiff > 10") |
||||||
|
List<Map<String,Object>> selectNeedCancelOrderList(); |
||||||
|
|
||||||
} |
} |
Loading…
Reference in new issue