| | |
| | | import com.ruoyi.im.service.UserPolicyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | |
| | | * 保险购买申请 |
| | | */ |
| | | @PostMapping("/purchaseApplication") |
| | | public Result purchaseApplication(@Valid @RequestBody UserPolicyDto dto) { |
| | | public Result purchaseApplication(UserPolicyDto dto) { |
| | | try { |
| | | return userPolicyService.purchaseApplication(dto); |
| | | }catch (Exception e){ |
| | | e.getMessage(); |
| | | e.printStackTrace(); |
| | | return Result.error("购买失败"); |
| | | } |
| | | } |
| | |
| | | List<UserPolicy> list = userPolicyService.list(new LambdaQueryWrapper<UserPolicy>().eq(UserPolicy::getUserId, id)); |
| | | return Result.success(list); |
| | | }catch (Exception e){ |
| | | e.getMessage(); |
| | | return Result.error("购买失败"); |
| | | e.printStackTrace(); |
| | | return Result.error("查询失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保单审批 |
| | | */ |
| | | @PostMapping("/examine") |
| | | @GetMapping("/examine") |
| | | @Transactional |
| | | public AjaxResult examine(@RequestParam(value = "id") Integer id, @RequestParam(value = "approvalStatus") Integer approvalStatus, @RequestParam(value = "message",required = false) String message) { |
| | | public AjaxResult examine(@RequestParam(value = "id") Integer id, |
| | | @RequestParam(value = "approvalStatus") Integer approvalStatus, |
| | | @RequestParam(value = "message",required = false) String message) { |
| | | try { |
| | | UserPolicy userPolicy = userPolicyService.getById(id); |
| | | if(ObjectUtil.isEmpty(userPolicy)){ |
| | |
| | | medicalInsuranceAccountService.save(medicalInsuranceAccount); |
| | | return AjaxResult.success("审批成功"); |
| | | }catch (Exception e){ |
| | | e.getMessage(); |
| | | e.printStackTrace(); |
| | | // 手动设置回滚 |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("审批失败!"); |
| | | } |
| | | } |