|
|
@@ -3,14 +3,22 @@ package com.ydtech.modules.order.controller;
|
|
|
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
+import com.ydtech.modules.admin.model.SysUser;
|
|
|
+import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
+import com.ydtech.modules.order.entity.InsOrdersTrack;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
+import com.ydtech.modules.order.service.InsOrdersTrackService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("/subOrder")
|
|
|
@Api(tags = "子订单")
|
|
|
@@ -20,6 +28,8 @@ public class InsAreaCompanyController {
|
|
|
|
|
|
private final InsAreaCompanyService insAreaCompanyService;
|
|
|
|
|
|
+ private final InsOrdersTrackService insOrdersTrackService;
|
|
|
+
|
|
|
@GetMapping("/statusInquiry/{subOrderNo}")
|
|
|
@ApiOperation("状态查询")
|
|
|
public HttpResult<String> statusInquiry(@PathVariable String subOrderNo) {
|
|
|
@@ -45,4 +55,24 @@ public class InsAreaCompanyController {
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/statusRestored/{subOrderNo}")
|
|
|
+ @ApiOperation("恢复核保状态")
|
|
|
+ @Transactional
|
|
|
+ public HttpResult<String> statusRestored(@PathVariable String subOrderNo) {
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(subOrderNo);
|
|
|
+ if (InsOrderStatusEnum.QUOTE_ING.getCode().equals(insAreaCompany.getOrderstatus())) {
|
|
|
+ SysUser user = BaseController.getUser();
|
|
|
+ List<InsOrdersTrack> list = insOrdersTrackService.lambdaQuery().eq(InsOrdersTrack::getOrderStatus, InsOrderStatusEnum.WAIT_PAY.getCode()).list();
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ InsOrdersTrack insOrdersTrack = new InsOrdersTrack(insAreaCompany, user.getId(), user.getName());
|
|
|
+ insAreaCompanyService.updateById(insAreaCompany);
|
|
|
+ insOrdersTrackService.save(insOrdersTrack);
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+ throw new SystemException("此订单未到达已核保待缴费,无法跟新状态");
|
|
|
+ }
|
|
|
+ throw new SystemException("订单状态无法恢复");
|
|
|
+ }
|
|
|
+
|
|
|
}
|