|
@@ -7,6 +7,10 @@ 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.StudentApplication;
|
|
|
+import com.jpsoft.picc.modules.business.entity.StudentApplicationRecord;
|
|
|
+import com.jpsoft.picc.modules.business.service.StudentApplicationRecordService;
|
|
|
+import com.jpsoft.picc.modules.business.service.StudentApplicationService;
|
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
@@ -20,6 +24,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
@RestController
|
|
@@ -30,11 +35,14 @@ public class StudentInsuranceController {
|
|
|
|
|
|
@Autowired
|
|
|
private InsuranceDefinitionService insuranceDefinitionService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private InsuranceDefinitionLimitService insuranceDefinitionLimitService;
|
|
|
@Autowired
|
|
|
private InsuranceJobsService insuranceJobsService;
|
|
|
+ @Autowired
|
|
|
+ private StudentApplicationService studentApplicationService;
|
|
|
+ @Autowired
|
|
|
+ private StudentApplicationRecordService studentApplicationRecordService;
|
|
|
|
|
|
@ApiOperation(value="获取信息")
|
|
|
@GetMapping("detail/{id}")
|
|
@@ -72,10 +80,10 @@ public class StudentInsuranceController {
|
|
|
|
|
|
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<String,Object> map = new HashMap<>();
|
|
|
map.put("name",insuranceDefinitionLimit.getName());
|
|
|
map.put("limit",insuranceDefinitionLimit.getLimit());
|
|
|
|
|
@@ -83,16 +91,90 @@ public class StudentInsuranceController {
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
+ map1.put("name","承保年龄");
|
|
|
+ map1.put("limit","3-18周岁");
|
|
|
+ list.add(map1);
|
|
|
+ Map<String,Object> map2 = new HashMap<>();
|
|
|
+ map2.put("name","保险期限");
|
|
|
+ map2.put("limit","1年");
|
|
|
+ list.add(map2);
|
|
|
+ Map<String,Object> map3 = new HashMap<>();
|
|
|
+ map3.put("name","保费金额");
|
|
|
+ map3.put("limit",insuranceJobs.get(0).getCharges());
|
|
|
+ list.add(map3);
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="添加信息")
|
|
|
+ @PostMapping("save")
|
|
|
+ public MessageResult<StudentApplication> save(
|
|
|
+ String insuredId,String insuredName,String insuredSex,String insuredSchoolId,String insuredSchoolName,String companyId,String companyName,String insuredCard,Boolean haveMedicare,
|
|
|
+ String attachId,String attachName,String relationship,String attachTel,
|
|
|
+ String definitionId,String definitionName,
|
|
|
+ Date startTime,Date endTime,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<StudentApplication> msgResult = new MessageResult<>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
+
|
|
|
+ try {
|
|
|
+ StudentApplication studentApplication = new StudentApplication();
|
|
|
+ studentApplication.setId(UUID.randomUUID().toString());
|
|
|
+ studentApplication.setInsuredId(insuredId);
|
|
|
+ studentApplication.setInsuredName(insuredName);
|
|
|
+ studentApplication.setInsuredSex(insuredSex);
|
|
|
+ studentApplication.setSchoolId(insuredSchoolId);
|
|
|
+ studentApplication.setSchoolName(insuredSchoolName);
|
|
|
+ studentApplication.setCompanyId(companyId);
|
|
|
+ studentApplication.setCompanyName(companyName);
|
|
|
+ studentApplication.setInsuredCard(insuredCard);
|
|
|
+ studentApplication.setHaveMedicare(haveMedicare);
|
|
|
+ studentApplication.setAttachId(attachId);
|
|
|
+ studentApplication.setAttachName(attachName);
|
|
|
+ studentApplication.setAttachRelationship(relationship);
|
|
|
+ studentApplication.setAttachTel(attachTel);
|
|
|
+ studentApplication.setDefinitionId(definitionId);
|
|
|
+ studentApplication.setDefinitionName(definitionName);
|
|
|
+ studentApplication.setPolicyNo(sdf.format(new Date()));
|
|
|
+ if(definitionId.equals("b318c3ac-c460-4d93-aa92-78b57efba125")) {
|
|
|
+ studentApplication.setHaveAttach(true);
|
|
|
+ }else{
|
|
|
+ studentApplication.setHaveAttach(false);
|
|
|
+ }
|
|
|
+ studentApplication.setStartTime(startTime);
|
|
|
+ studentApplication.setEndTime(endTime);
|
|
|
+ studentApplication.setDelFlag(false);
|
|
|
+ studentApplication.setCreateBy(subject);
|
|
|
+ studentApplication.setCreateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = studentApplicationService.insert(studentApplication);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ StudentApplicationRecord studentApplicationRecord = new StudentApplicationRecord();
|
|
|
+ studentApplicationRecord.setId(UUID.randomUUID().toString());
|
|
|
+ studentApplicationRecord.setApplicationId(studentApplication.getId());
|
|
|
+ studentApplicationRecord.setProcessStatus("正常");
|
|
|
+ studentApplicationRecord.setStatus("10");
|
|
|
+ studentApplicationRecord.setDelFlag(false);
|
|
|
+ studentApplicationRecord.setCreateBy(subject);
|
|
|
+ studentApplicationRecord.setCreateTime(new Date());
|
|
|
+ studentApplicationRecordService.insert(studentApplicationRecord);
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|