提交代码

dev-discount
胡锐 3 years ago
parent 2f8289556f
commit 0e1623165a
  1. 12
      hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java
  2. 6
      hai-service/src/main/java/com/hai/service/HighOrderPreService.java
  3. 27
      hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java

@ -123,17 +123,7 @@ public class HighOrderPreController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
// 查询预约订单详情 highOrderPreService.orderComplete(body.getLong("preOrderId"));
HighOrderPre orderPre = highOrderPreService.findByOrderId(body.getLong("preOrderId"));
if (orderPre == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到预约订单");
}
if (orderPre.getStatus() != 2) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
orderPre.setStatus(3);
orderPre.setUpdateTime(new Date());
highOrderPreService.updateOrderPre(orderPre);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");

@ -57,4 +57,10 @@ public interface HighOrderPreService {
* @return void * @return void
**/ **/
void updateOrderPre(HighOrderPre highOrderPre); void updateOrderPre(HighOrderPre highOrderPre);
/**
* 订单完成
* @param preOrderId
*/
void orderComplete(Long preOrderId);
} }

@ -1,14 +1,20 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.dao.HighOrderPreMapper; import com.hai.dao.HighOrderPreMapper;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPre;
import com.hai.entity.HighOrderPreExample; import com.hai.entity.HighOrderPreExample;
import com.hai.service.HighOrderPreService; import com.hai.service.HighOrderPreService;
import com.hai.service.HighOrderService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
@ -21,6 +27,9 @@ public class HighOrderPreServiceImpl implements HighOrderPreService {
@Resource @Resource
private HighOrderPreMapper highOrderPreMapper; private HighOrderPreMapper highOrderPreMapper;
@Resource
private HighOrderService highOrderService;
@Override @Override
public List<HighOrderPre> getListOrderPre(Map<String, Object> map) { public List<HighOrderPre> getListOrderPre(Map<String, Object> map) {
HighOrderPreExample example = new HighOrderPreExample(); HighOrderPreExample example = new HighOrderPreExample();
@ -112,4 +121,22 @@ public class HighOrderPreServiceImpl implements HighOrderPreService {
public void updateOrderPre(HighOrderPre highOrderPre) { public void updateOrderPre(HighOrderPre highOrderPre) {
highOrderPreMapper.updateByPrimaryKey(highOrderPre); highOrderPreMapper.updateByPrimaryKey(highOrderPre);
} }
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void orderComplete(Long preOrderId) {
// 查询预约订单详情
HighOrderPre orderPre = findByOrderId(preOrderId);
if (orderPre == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到预约订单");
}
if (orderPre.getStatus() != 2) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
orderPre.setStatus(3);
orderPre.setUpdateTime(new Date());
updateOrderPre(orderPre);
highOrderService.childOrderComplete(orderPre.getChildOrderId());
}
} }

Loading…
Cancel
Save