|
|
@@ -0,0 +1,116 @@
|
|
|
+package com.ydtech.modules.fnc.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.ydtech.aop.request.RequestSingleParam;
|
|
|
+import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
+import com.ydtech.modules.base.controller.BaseController;
|
|
|
+import com.ydtech.modules.fee.service.FeeRuleSchemeService;
|
|
|
+import com.ydtech.modules.fee.service.impl.FeeRuleSchemeServiceImpl;
|
|
|
+import com.ydtech.modules.fnc.entity.InsFeeAudit;
|
|
|
+import com.ydtech.modules.fnc.service.InsFeeAuditService;
|
|
|
+import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
+import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
+import com.ydtech.modules.order.entity.InsAccidentalDriving;
|
|
|
+import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
+import com.ydtech.modules.order.entity.InsOrders;
|
|
|
+import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
|
|
|
+import com.ydtech.modules.order.entity.vo.*;
|
|
|
+import com.ydtech.modules.order.service.InsAccidentalDrivingService;
|
|
|
+import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
+import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Api(tags = "财务-车险结算")
|
|
|
+@RequestMapping("/fnc/carSettle")
|
|
|
+@RestController
|
|
|
+public class CarSettleController extends BaseController {
|
|
|
+
|
|
|
+ private final InsOrdersService insOrdersService;
|
|
|
+
|
|
|
+ private final InsAreaCompanyService insAreaCompanyService;
|
|
|
+
|
|
|
+ private final InsFeeAuditService insFeeAuditService;
|
|
|
+
|
|
|
+ public CarSettleController(InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsFeeAuditService insFeeAuditService) {
|
|
|
+ this.insAreaCompanyService = insAreaCompanyService;
|
|
|
+ this.insOrdersService = insOrdersService;
|
|
|
+ this.insFeeAuditService = insFeeAuditService;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据费用审核状态查询订单 auditStatus
|
|
|
+ * @param orderQueryVo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/queryPageOrder")
|
|
|
+ @ApiOperation(value = "[1]分页查询订单接口")
|
|
|
+ public HttpResult<BasePageResult<InsOrders>> queryPageOrder(@RequestBody @Valid OrderQueryVo orderQueryVo) {
|
|
|
+ orderQueryVo.setOrderStatus("3");//3已承保
|
|
|
+ BasePageResult<InsOrders> quoteResult = this.insOrdersService.queryPageOrder(orderQueryVo);
|
|
|
+ return HttpResult.ok("success", quoteResult);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 根据订单号查询费用明细
|
|
|
+ * @param orderNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/feeDetail")
|
|
|
+ @ApiOperation(value = "[2]根据订单号查询费用明细")
|
|
|
+ public HttpResult<OrderVo> queryFeeDetail(@RequestSingleParam(value = "orderNo") @Valid String orderNo) {
|
|
|
+ //查询已承保的子订单号
|
|
|
+ List<InsAreaCompany> areaList =insAreaCompanyService.query()
|
|
|
+ .eq(StringUtils.isNotEmpty(orderNo),"orderno",orderNo)
|
|
|
+ .eq("orderstatus","3").list();//3已承保
|
|
|
+ if(areaList!=null && areaList.size()>0){
|
|
|
+ return insOrdersService.getByCompanyId(areaList.get(0).getInsOrderNo());
|
|
|
+ }else{
|
|
|
+ return HttpResult.error("订单号有误-未承保");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 费用审核
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/auditFee")
|
|
|
+ @ApiOperation(value = "[3]费用审核")
|
|
|
+ public HttpResult auditFee(@RequestSingleParam(value = "orderNo") String orderNo) {
|
|
|
+ //查询改订单是已审核
|
|
|
+ List<InsFeeAudit> feeList =insFeeAuditService.query().eq("orderno",orderNo).list();
|
|
|
+ if(feeList!=null &&feeList.size()>0){
|
|
|
+ return HttpResult.error("该订单已审核");
|
|
|
+ }
|
|
|
+ //查询已承保的子订单号
|
|
|
+ List<InsAreaCompany> areaList =insAreaCompanyService.query()
|
|
|
+ .eq(StringUtils.isNotEmpty(orderNo),"orderno",orderNo)
|
|
|
+ .eq("orderstatus","3").list();//3已承保
|
|
|
+ if(areaList!=null && areaList.size()>0){
|
|
|
+ InsFeeAudit insFeeAudit=new InsFeeAudit();
|
|
|
+ insFeeAudit.setOrderno(orderNo);
|
|
|
+ insFeeAudit.setInsOrderNo(areaList.get(0).getInsOrderNo());
|
|
|
+ insFeeAudit.setAuditstatus("1");
|
|
|
+ insFeeAudit.setAudittime(LocalDateTime.now());
|
|
|
+ insFeeAudit.setAudituser(getUserId());
|
|
|
+ insFeeAuditService.save(insFeeAudit);
|
|
|
+ return HttpResult.ok();
|
|
|
+ }else{
|
|
|
+ return HttpResult.error("订单号有误-未承保");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|