修复到期提醒错误问题
This commit is contained in:
@@ -9,6 +9,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
@@ -223,7 +224,7 @@ public class OrderTask {
|
||||
// @Scheduled(cron="0 0/2 * * * ? ")
|
||||
@Scheduled(cron="${cron.profit:-}")
|
||||
@Transactional
|
||||
public void CalcProfit() {
|
||||
public void calcProfit() {
|
||||
// 查询所有未结算订单
|
||||
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery(OrderPay.class)
|
||||
.eq(OrderPay::getIsSettled, ORDER_SETTLED_NO)
|
||||
@@ -469,6 +470,7 @@ public class OrderTask {
|
||||
log.info("开始发送订单到期预警通知!");
|
||||
int succ = 0;
|
||||
for(Order order : alertList){
|
||||
log.info("预警推送订单数据:{}", JSON.toJSONString(order));
|
||||
SmsCaptchaParam aram = SmsCaptchaParam.builder()
|
||||
.phone(order.getPhone())
|
||||
.type(ESmsType.ALERT.name())
|
||||
@@ -485,11 +487,12 @@ public class OrderTask {
|
||||
log.info(">>>>>>>>>>>>>>>>>>发送订单到期预警通知结束!总数{}条,成功{}条!", alertList.size(), succ);
|
||||
}
|
||||
|
||||
List<Order> overdueList = orderService.findAlertList();
|
||||
List<Order> overdueList = orderService.findOverdueList();
|
||||
if(CollectionUtil.isNotEmpty(overdueList)) {
|
||||
log.info("开始发送订单超期提醒通知!");
|
||||
int succ = 0;
|
||||
for(Order order : overdueList){
|
||||
log.info("超期推送订单数据:{}", JSON.toJSONString(order));
|
||||
SmsCaptchaParam aram = SmsCaptchaParam.builder()
|
||||
.phone(order.getPhone())
|
||||
.type(ESmsType.OVERDUE.name())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.CommonRequest;
|
||||
import com.aliyuncs.CommonResponse;
|
||||
@@ -212,14 +213,15 @@ public class MainController extends BaseController {
|
||||
|
||||
@ApiOperation("短信验证码")
|
||||
@PostMapping("/sendSmsCaptcha")
|
||||
public ApiResult<?> sendSmsCaptcha(@RequestBody @Valid SmsCaptchaParam param) {
|
||||
public ApiResult<?> sendSmsCaptcha(@RequestBody @Validated SmsCaptchaParam param) {
|
||||
try {
|
||||
// User user = getLoginUser();
|
||||
// param.setTenantId(user.getTenantId());
|
||||
|
||||
int iCode = new Random().nextInt(999999) + 1000000;
|
||||
String code = String.valueOf(iCode).substring(1);
|
||||
param.setTemplateParam("{\"code\":" + code + "}");
|
||||
// int iCode = new Random().nextInt(999999) + 1000000;
|
||||
// String code = String.valueOf(iCode).substring(1);
|
||||
String code = RandomStringUtils.randomNumeric(6);
|
||||
param.setTemplateParam("{\"code\":\"" + code + "\"}");
|
||||
ApiResult ret = aliSmsService.sendSms(param);
|
||||
if(ret.isOk()){
|
||||
ESmsType type = ESmsType.valueOf(param.getType());
|
||||
|
||||
@@ -59,6 +59,7 @@ public class AliSmsServiceImpl implements AliSmsService {
|
||||
request.putQueryParameter("TemplateCode", type.getTemplateId());
|
||||
request.putQueryParameter("TemplateParam", param.getTemplateParam());
|
||||
|
||||
log.info("发出验证码参数为{}", JSON.toJSONString(param));
|
||||
CommonResponse response = client.getCommonResponse(request);
|
||||
String json = response.getData();
|
||||
JSONObject result = JSON.parseObject(json);
|
||||
|
||||
@@ -47,11 +47,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.gxwebsoft.apps.constants.EquipmentConstants.*;
|
||||
import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
||||
@@ -272,7 +269,6 @@ public class OpenEquipmentController extends BaseController {
|
||||
param.put("userName", loginUser.getNickname());
|
||||
param.put("userPhone", loginUser.getPhone());
|
||||
param.put("battery_sn", one.getEquipmentCode());
|
||||
System.out.println("param = " + param);
|
||||
try {
|
||||
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity("http://battery.zfdliot.com/api/battery/batteryBindUser", param, JSONObject.class);
|
||||
JSONObject body = responseEntity.getBody();
|
||||
@@ -390,7 +386,7 @@ public class OpenEquipmentController extends BaseController {
|
||||
@ApiOperation("确认收货")
|
||||
@PostMapping("/receipt")
|
||||
@OperationLog
|
||||
public ApiResult<?> receipt(@RequestBody @Valid OrderReceiptParam receiptParam) {
|
||||
public ApiResult<?> receipt(@RequestBody @Validated OrderReceiptParam receiptParam) {
|
||||
// 验证签名
|
||||
isCheckSign();
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ public class OrderPayController extends BaseController {
|
||||
|
||||
EquipmentGoods eg = equipmentGoodsService.getById(order.getOrderSourceId());
|
||||
// 是否提前续租
|
||||
Integer isRenew = order.getIsRenew();
|
||||
if(one == null) {
|
||||
if(ORDER_STATUS_OVER.equals(order.getOrderStatus())) {
|
||||
return fail(null);
|
||||
@@ -147,10 +148,9 @@ public class OrderPayController extends BaseController {
|
||||
orderPayService.save(one);
|
||||
}
|
||||
one.setIsFreeze(order.getIsFreeze());
|
||||
Integer isRenew = order.getIsRenew();
|
||||
one.setIsRenew(isRenew);
|
||||
|
||||
if(isRenew == 0){
|
||||
if(isRenew == null || isRenew == 0){
|
||||
String freezeOrderNo = order.getFreezeOrderNo();
|
||||
if(StrUtil.isNotBlank(freezeOrderNo)){
|
||||
LambdaQueryWrapper<FreezeOrder> fWrapper = Wrappers.lambdaQuery();
|
||||
|
||||
@@ -62,10 +62,10 @@ public interface OrderMapper extends BaseMapper<Order> {
|
||||
* 查找到期预警订单
|
||||
* @return
|
||||
*/
|
||||
@Select("select u.phone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay " +
|
||||
@Select("select u.phone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay, o.order_no orderNo " +
|
||||
"from shop_order o join sys_user u on o.user_id = u.user_id " +
|
||||
"where DATEDIFF(o.expiration_time,CURDATE()) in (1, 0) and u.phone is not null " +
|
||||
"and o.pay_status = 20 and o.order_status != 40")
|
||||
"and o.pay_status = 20 and o.order_status != 40 and o.is_renew = 0")
|
||||
@ResultType(Order.class)
|
||||
List<Order> selectAlertList();
|
||||
|
||||
@@ -73,10 +73,10 @@ public interface OrderMapper extends BaseMapper<Order> {
|
||||
* 查找超期1天订单
|
||||
* @return
|
||||
*/
|
||||
@Select("select u.phone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay " +
|
||||
@Select("select u.phone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay, o.order_no orderNo " +
|
||||
"from shop_order o join sys_user u on o.user_id = u.user_id " +
|
||||
"where DATEDIFF(o.expiration_time,CURDATE()) = -1 and u.phone is not null " +
|
||||
"and o.pay_status = 20 and o.order_status != 40")
|
||||
"and o.pay_status = 20 and o.order_status != 40 and o.is_renew = 0")
|
||||
@ResultType(Order.class)
|
||||
List<Order> selectOutOfOneDayList();
|
||||
}
|
||||
|
||||
@@ -21,23 +21,23 @@ public class OrderReceiptParam implements Serializable {
|
||||
@NotBlank(message = "身份信息数据不能为空!")
|
||||
private String orderSourceData;
|
||||
|
||||
// @ApiModelProperty(value = "验证码", required = true)
|
||||
// @NotBlank(message = "验证码不能为空!")
|
||||
@ApiModelProperty(value = "验证码", required = true)
|
||||
@NotBlank(message = "验证码不能为空!")
|
||||
private String captcha;
|
||||
|
||||
// @ApiModelProperty(value = "收货人手机号", required = true)
|
||||
// @NotBlank(message = "收货人手机号不能为空!")
|
||||
@ApiModelProperty(value = "收货人手机号", required = true)
|
||||
@NotBlank(message = "收货人手机号不能为空!")
|
||||
private String receiptPhone;
|
||||
|
||||
// @ApiModelProperty(value = "紧急联系人")
|
||||
// @NotBlank(message = "紧急联系人不能为空!")
|
||||
@ApiModelProperty(value = "紧急联系人")
|
||||
@NotBlank(message = "紧急联系人不能为空!")
|
||||
private String emergentUser;
|
||||
|
||||
// @ApiModelProperty(value = "单位地址")
|
||||
// @NotBlank(message = "单位地址不能为空!")
|
||||
@ApiModelProperty(value = "单位地址")
|
||||
@NotBlank(message = "单位地址不能为空!")
|
||||
private String officeAddress;
|
||||
|
||||
// @ApiModelProperty(value = "家庭地址")
|
||||
// @NotBlank(message = "家庭地址不能为空!")
|
||||
@ApiModelProperty(value = "家庭地址")
|
||||
@NotBlank(message = "家庭地址不能为空!")
|
||||
private String homeAddress;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.gxwebsoft.shop.param.OrderParam;
|
||||
import com.gxwebsoft.shop.service.FreezeOrderService;
|
||||
import com.gxwebsoft.shop.service.OrderGoodsService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -44,6 +45,7 @@ import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
||||
* @author WebSoft
|
||||
* @since 2022-11-16 11:25:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
@Resource
|
||||
@@ -208,7 +210,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Override
|
||||
public ApiResult paySuccess(AlipayTradeQueryResponse params) {
|
||||
System.out.println("支付成功后处理的业务");
|
||||
log.info("支付成功后处理的业务");
|
||||
String outTradeNo = params.getOutTradeNo();
|
||||
String totalAmount = params.getTotalAmount();
|
||||
String receiptAmount = params.getReceiptAmount();
|
||||
|
||||
Reference in New Issue
Block a user