|  |  |  | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.CountCyclePriceDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.InsuranceApplyOptDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.SmsCheckDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.*; | 
|---|
|  |  |  | import com.doumee.dao.business.model.InsuranceApply; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.ApplyPowerVO; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.CountCyclePriceVO; | 
|---|
|  |  |  | import com.doumee.service.business.InsuranceApplyService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import io.swagger.models.auth.In; | 
|---|
|  |  |  | import org.apache.shiro.SecurityUtils; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("business:insuranceapply:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody InsuranceApply insuranceApply) { | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); | 
|---|
|  |  |  | return ApiResponse.success(insuranceApplyService.create(insuranceApply)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequiresPermissions("business:insuranceapply:query") | 
|---|
|  |  |  | public ApiResponse<PageData<InsuranceApply>> findPage (@RequestBody PageWrap<InsuranceApplyQueryDTO> pageWrap) { | 
|---|
|  |  |  | PageData<InsuranceApply> pageData = insuranceApplyService.findPage(pageWrap); | 
|---|
|  |  |  | pageData.getRecords().forEach(i->{ | 
|---|
|  |  |  | if(i.getSolutionType().equals(Constants.ONE)&&!i.getStatus().equals(Constants.InsuranceApplyStatus.WTB_DONE.getKey())){ | 
|---|
|  |  |  | i.setFee(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return ApiResponse.success(pageData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequiresPermissions("business:insuranceapply:exportExcel") | 
|---|
|  |  |  | public void exportDetailExcel (@RequestBody  InsuranceApply model, HttpServletResponse response) { | 
|---|
|  |  |  | InsuranceApply insuranceApply =   insuranceApplyService.findDetailForExport(model); | 
|---|
|  |  |  | if(Objects.nonNull(insuranceApply)&&insuranceApply.getSolutionType().equals(Constants.ONE) | 
|---|
|  |  |  | &&!insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WTB_DONE.getKey())){ | 
|---|
|  |  |  | insuranceApply.setFee(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelExporter.build(InsuranceApply.class).exportApplyDetail(insuranceApply,  response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequiresPermissions("business:insuranceapply:query") | 
|---|
|  |  |  | public ApiResponse<InsuranceApply> findById(@PathVariable Integer id) { | 
|---|
|  |  |  | InsuranceApply insuranceApply = insuranceApplyService.findDetail(id); | 
|---|
|  |  |  | if(Objects.nonNull(insuranceApply)&&insuranceApply.getSolutionType().equals(Constants.ONE)&&!insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WTB_DONE.getKey())){ | 
|---|
|  |  |  | insuranceApply.setFee(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success(insuranceApply); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("企业签署保单") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("测试实际金额") | 
|---|
|  |  |  | @GetMapping("/testFee") | 
|---|
|  |  |  | public ApiResponse testFee(Integer id) { | 
|---|
|  |  |  | insuranceApplyService.updateApplyCurrentFee(id); | 
|---|
|  |  |  | public ApiResponse testFee(Integer id,Integer unionId) { | 
|---|
|  |  |  | insuranceApplyService.updateApplyCurrentFee(id, unionId); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return ApiResponse.success(insuranceApplyService.getSignWTBTBDLink(smsCheckDTO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("查询保单是否可进行加减保") | 
|---|
|  |  |  | @PostMapping("/getApplyPower") | 
|---|
|  |  |  | @RequiresPermissions("business:insuranceapply:query") | 
|---|
|  |  |  | public ApiResponse<ApplyPowerVO> getApplyPower(@RequestBody ApplyPowerDTO applyPowerDTO) { | 
|---|
|  |  |  | return ApiResponse.success(insuranceApplyService.getApplyPower(applyPowerDTO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|