|
@@ -2,13 +2,23 @@ package com.jpsoft.picc.modules.business.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.business.entity.InsuranceApplication;
|
|
|
+import com.jpsoft.picc.modules.business.entity.InsurancePolicy;
|
|
|
import com.jpsoft.picc.modules.business.entity.StudentApplication;
|
|
|
import com.jpsoft.picc.modules.business.service.StudentApplicationService;
|
|
|
import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.picc.modules.common.utils.NumberToCN;
|
|
|
import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.picc.modules.common.utils.VelocityHelper;
|
|
|
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;
|
|
@@ -35,6 +45,12 @@ public class StudentApplicationController {
|
|
|
@Autowired
|
|
|
private InsuranceDefinitionService insuranceDefinitionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InsuranceDefinitionLimitService insuranceDefinitionLimitService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsuranceJobsService insuranceJobsService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
public MessageResult<StudentApplication> create(){
|
|
@@ -329,4 +345,126 @@ public class StudentApplicationController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="获取投保信息")
|
|
|
+ @PostMapping("detail")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="id",value = "投保信息ID",required = true,paramType = "query")
|
|
|
+ })
|
|
|
+ public MessageResult<StudentApplication> detail(String id){
|
|
|
+ MessageResult<StudentApplication> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ StudentApplication studentApplication = studentApplicationService.get(id);
|
|
|
+
|
|
|
+ if (studentApplication != null) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(studentApplication);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取承保信息")
|
|
|
+ @RequestMapping(value = "acceptDetail",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="applicationId",value = "投保单ID",required = true,paramType = "query")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> acceptDetail(String applicationId){
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
+
|
|
|
+ //投保单
|
|
|
+ StudentApplication studentApplication = studentApplicationService.get(applicationId);
|
|
|
+
|
|
|
+ //险种
|
|
|
+ InsuranceDefinition insuranceDefinition = insuranceDefinitionService.get(studentApplication.getDefinitionId());
|
|
|
+
|
|
|
+ String definitionId = insuranceDefinition.getId();
|
|
|
+
|
|
|
+ map.put("id",insuranceDefinition.getId());
|
|
|
+ map.put("name",insuranceDefinition.getName());
|
|
|
+
|
|
|
+ List<InsuranceDefinitionLimit> insuranceDefinitionLimitList = insuranceDefinitionLimitService.findByDefinitionId(definitionId);
|
|
|
+
|
|
|
+ List<Map<String,Object>> mapList = new ArrayList<Map<String,Object>>();
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,Object> varsMap = new HashMap<>();
|
|
|
+ varsMap.put("num",1);
|
|
|
+
|
|
|
+ for(InsuranceDefinitionLimit insuranceDefinitionLimit:insuranceDefinitionLimitList){
|
|
|
+ Map<String,Object> map1 = new HashMap<String,Object>();
|
|
|
+ map1.put("id",insuranceDefinitionLimit.getId());
|
|
|
+ map1.put("name",insuranceDefinitionLimit.getName());
|
|
|
+
|
|
|
+ //限额这里可能是公式,需要带入人数
|
|
|
+ String limit = VelocityHelper.format(insuranceDefinitionLimit.getLimit(),varsMap);
|
|
|
+ map1.put("limit",limit);
|
|
|
+
|
|
|
+ String unit = VelocityHelper.format(insuranceDefinitionLimit.getUnit(),varsMap);
|
|
|
+ map1.put("unit",unit);
|
|
|
+
|
|
|
+ mapList.add(map1);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("insuranceDefinitionLimitList",mapList);
|
|
|
+
|
|
|
+ List<InsuranceJobs> InsuranceJobsList = insuranceJobsService.findByDefinitionId(studentApplication.getDefinitionId());
|
|
|
+
|
|
|
+ List<Map<String,Object>> mapList1 = new ArrayList<Map<String,Object>>();
|
|
|
+
|
|
|
+ DateTime startTime = new DateTime(studentApplication.getStartTime());
|
|
|
+ map.put("startTime",startTime.toString("yyyy-MM-dd"));
|
|
|
+
|
|
|
+ DateTime endTime = new DateTime(studentApplication.getEndTime());
|
|
|
+ map.put("endTime",endTime.toString("yyyy-MM-dd"));
|
|
|
+
|
|
|
+ //月份
|
|
|
+ int months = 1;
|
|
|
+
|
|
|
+ BigDecimal totalAmount = new BigDecimal(0);
|
|
|
+
|
|
|
+ for (InsuranceJobs insuranceJobs:InsuranceJobsList) {
|
|
|
+ Map<String,Object> map1 = new HashMap<String,Object>();
|
|
|
+ String jobId = insuranceJobs.getJobsId();
|
|
|
+ map1.put("id",jobId);
|
|
|
+ map1.put("name",insuranceJobs.getJobs().getName());
|
|
|
+ map1.put("content",insuranceJobs.getJobs().getContent());
|
|
|
+ map1.put("charges",insuranceJobs.getCharges());
|
|
|
+ map1.put("chargesY",insuranceJobs.getCharges().multiply(new BigDecimal(12)));
|
|
|
+ long memberCount = 1;
|
|
|
+ long number = Long.valueOf(memberCount).intValue();
|
|
|
+ map1.put("number",number);
|
|
|
+ BigDecimal money = insuranceJobs.getCharges().multiply(new BigDecimal(months)).multiply(new BigDecimal(number));
|
|
|
+ map1.put("money",money);
|
|
|
+
|
|
|
+ totalAmount = totalAmount.add(money);
|
|
|
+ mapList1.add(map1);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("totalAmount",totalAmount);
|
|
|
+
|
|
|
+ String cnMontrayUnit = NumberToCN.number2CNMontrayUnit(totalAmount);
|
|
|
+ map.put("cnMontrayUnit",cnMontrayUnit);
|
|
|
+
|
|
|
+ map.put("jobsList",mapList1);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|