|
@@ -0,0 +1,98 @@
|
|
|
+package com.jpsoft.picc.modules.base.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.picc.modules.base.entity.InsuranceDefinition;
|
|
|
+import com.jpsoft.picc.modules.base.entity.InsuranceDefinitionLimit;
|
|
|
+import com.jpsoft.picc.modules.base.entity.InsuranceJobs;
|
|
|
+import com.jpsoft.picc.modules.base.service.InsuranceDefinitionLimitService;
|
|
|
+import com.jpsoft.picc.modules.base.service.InsuranceDefinitionService;
|
|
|
+import com.jpsoft.picc.modules.base.service.InsuranceJobsService;
|
|
|
+import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/studentInsurance")
|
|
|
+@Api(description = "险种信息")
|
|
|
+public class StudentInsuranceController {
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsuranceDefinitionService insuranceDefinitionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsuranceDefinitionLimitService insuranceDefinitionLimitService;
|
|
|
+ @Autowired
|
|
|
+ private InsuranceJobsService insuranceJobsService;
|
|
|
+
|
|
|
+ @ApiOperation(value="获取信息")
|
|
|
+ @GetMapping("detail/{id}")
|
|
|
+ public MessageResult<Map> edit(@PathVariable("id") String id){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ InsuranceDefinition insuranceDefinition = insuranceDefinitionService.get(id);
|
|
|
+
|
|
|
+ map.put("致家长的一封信",insuranceDefinition.getLetter());
|
|
|
+ map.put("保障计划",getLimitList(insuranceDefinition.getId(),false,"3a1da4e2-7274-414b-bbc5-c0b37032db17"));
|
|
|
+ map.put("特别声明",insuranceDefinition.getSpecialStatement());
|
|
|
+ map.put("保险条款",insuranceDefinition.getClause());
|
|
|
+ map.put("投保声明",insuranceDefinition.getInsuranceDescription());
|
|
|
+ map.put("责任免除说明",insuranceDefinition.getExemptionInstructions());
|
|
|
+ map.put("保险责任文本",insuranceDefinition.getResponsibility());
|
|
|
+ if(insuranceDefinition.getHaveAttach()) {
|
|
|
+ map.put("附加险保险责任文本", insuranceDefinition.getResponsibilityAttach());
|
|
|
+ map.put("附加险保障计划",getLimitList(insuranceDefinition.getId(),true,"98f3ac96-bdf6-45d5-acca-c4561baeaf20"));
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Map<String,Object>> getLimitList(String definitionId, Boolean isAttach, String JobsId){
|
|
|
+ List<Map<String,Object>> list = new ArrayList<>();
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ List<InsuranceDefinitionLimit> insuranceDefinitionLimitList = insuranceDefinitionLimitService.findByDefinitionIdAndIsAttach(definitionId,isAttach);
|
|
|
+ for(InsuranceDefinitionLimit insuranceDefinitionLimit : insuranceDefinitionLimitList){
|
|
|
+ map.put("name",insuranceDefinitionLimit.getName());
|
|
|
+ map.put("limit",insuranceDefinitionLimit.getLimit());
|
|
|
+
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<InsuranceJobs> insuranceJobs = insuranceJobsService.findByDefinitionIdAndJobId(definitionId,JobsId);
|
|
|
+ map.put("name","承保年龄");
|
|
|
+ map.put("limit","3-18周岁");
|
|
|
+ list.add(map);
|
|
|
+ map.put("name","保险期限");
|
|
|
+ map.put("limit","1年");
|
|
|
+ list.add(map);
|
|
|
+ map.put("name","保费金额");
|
|
|
+ map.put("limit",insuranceJobs.get(0).getCharges());
|
|
|
+ list.add(map);
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+}
|